void Config_port_state(int id,struct list *lpublic,struct list *lcon) { int ret; char *port_name=(char *)malloc(10); char *port_state=(char *)malloc(10); memset(port_name,0,10); cgiFormStringNoNewlines("port_num",port_name,10); memset(port_state,0,10); cgiFormStringNoNewlines("port_state",port_state,10); ccgi_dbus_init(); ret=set_port_state(id,port_name,port_state); switch(ret) { case 0:ShowAlert(search(lcon,"con_port_state_fail")); break; case 1:ShowAlert(search(lcon,"con_port_state_succ")); break; case -1:ShowAlert(search(lcon,"unknown_portno_format")); break; case -2:ShowAlert(search(lcon,"port_is_not_trunk_member")); break; case -3:ShowAlert(search(lcon,"port_already_enable")); break; case -4:ShowAlert(search(lcon,"port_not_enable")); break; case -5:ShowAlert(search(lpublic,"error")); break; } free(port_name); free(port_state); }
int cgiMain() { char encry[BUF_LEN] = { 0 }; char *str = NULL; struct list *lpublic = NULL; /*解析public.txt文件的链表头*/ struct list *lwlan = NULL; /*解析wlan.txt文件的链表头*/ memset(encry,0,sizeof(encry)); lpublic=get_chain_head("../htdocs/text/public.txt"); lwlan=get_chain_head("../htdocs/text/wlan.txt"); DcliWInit(); ccgi_dbus_init(); if(cgiFormStringNoNewlines("UN", encry, BUF_LEN)!=cgiFormNotFound ) /*首次进入该页*/ { str=dcryption(encry); if(str==NULL) ShowErrorPage(search(lpublic,"ill_user")); /*用户非法*/ else ShowWtpnewPage(encry,lpublic,lwlan); } else { cgiFormStringNoNewlines("encry_newwtp",encry,BUF_LEN); str=dcryption(encry); if(str==NULL) ShowErrorPage(search(lpublic,"ill_user")); /*用户非法*/ else ShowWtpnewPage(encry,lpublic,lwlan); } release(lpublic); release(lwlan); destroy_ccgi_dbus(); return 0; }
int check_password() { char username[30]; char password[30]; memset(username,0,sizeof(username)); memset(password,0,sizeof(password)); if(cgiFormNotFound == cgiFormStringNoNewlines("j_password", password, 30)) { //fprintf(cgiOut, "<p> cgiFormNotFound</p>\n"); cgiCookieString("admin", password, sizeof(password)); memcpy(username,"admin",5); //fprintf(cgiOut, "<p> ==11%s==%s----%s</p>\n",cgiRemoteAddr,username,password); } else { cgiFormStringNoNewlines("j_username", username, 30); cgiFormStringNoNewlines("j_password", password, 30); } //fprintf(cgiOut, "<p> %s----%s</p>\n",username,password); if(!memcmp(username,"admin",5) && !memcmp(password,"asdf1~",6)) { return 1; } else { fprintf(cgiOut, "<p> 用户未登录或密码错误,请返回重新输入!</p>\n"); fprintf(cgiOut, " <input type=\"button\" name=\"rest\" onclick=\"javascript:window.location.href='/index.html'\" value=\"返回\" />\n"); fprintf(cgiOut, "</center>\n</body>\n"); fprintf(cgiOut, "</html>\n"); return 0; } }
void modifySyslog_hand(struct list *lpublic, struct list *lsystem) { char na[N]={0}; char log[10]={0}; char oper[10]={0}; int ret = 0; memset(na,0,N); /*清空临时变量*/ memset(log,0,10); memset(oper,0,10); cgiFormStringNoNewlines("a_name", na, N); cgiFormStringNoNewlines("log_lever",log,10); cgiFormStringNoNewlines("oper_lever",oper,10); ret = mod_user_syslog_by_name(na,log,oper); if(ret == 1) { ShowAlert(search(lpublic,"oper_succ")); } else { ShowAlert(search(lpublic,"oper_fail")); } }
void CookieSet() { char username[30]; char password[30]; memset(username,0,sizeof(username)); memset(password,0,sizeof(password)); if(cgiFormNotFound == cgiFormStringNoNewlines("j_password", password, 30)) { return; } else { cgiFormStringNoNewlines("j_username", username, 30); cgiFormStringNoNewlines("j_password", password, 30); } if(!memcmp(username,"admin",5) && !memcmp(password,"asdf1~",6)) { cgiHeaderCookieSetString(username, password, 86400, "/", getenv("HTTP_HOST")); return ; } else { return ; } }
int cgiMain() { char encry[BUF_LEN] = { 0 }; char page_no[10] = { 0 }; char *str = NULL; char *endptr = NULL; int pno = 0; struct list *lpublic = NULL; /*解析public.txt文件的链表头*/ struct list *lwlan = NULL; /*解析wlan.txt文件的链表头*/ lpublic=get_chain_head("../htdocs/text/public.txt"); lwlan=get_chain_head("../htdocs/text/wlan.txt"); DcliWInit(); ccgi_dbus_init(); memset(encry,0,sizeof(encry)); memset(page_no,0,sizeof(page_no)); cgiFormStringNoNewlines("UN", encry, BUF_LEN); str=dcryption(encry); if(str==NULL) ShowErrorPage(search(lpublic,"ill_user")); /*用户非法*/ else { if(cgiFormStringNoNewlines("PN", page_no, 10)!=cgiFormNotFound ) /*点击翻页进入该页面*/ { pno= strtoul(page_no,&endptr,10); /*char转成int,10代表十进制*/ ShowStationPage(encry,pno,lpublic,lwlan); } else ShowStationPage(encry,0,lpublic,lwlan); } release(lpublic); release(lwlan); destroy_ccgi_dbus(); return 0; }
void dhcp_relay_status(struct list *lcontrol,struct list *lpublic,char *addn) { if(checkuser_group(addn)==0) { char allslotid[10] = {0}; int allslot_id = 0; cgiFormStringNoNewlines("allslot",allslotid,sizeof(allslotid)); allslot_id = atoi(allslotid); char status[20] = {0}; cgiFormStringNoNewlines("State",status,20); unsigned int ifenable = 0; int ret = -1; /////enable or disable if (strcmp(status,"stop") == 0) { ifenable = 0; } else if (strcmp(status,"start") == 0) { ifenable = 1; } ret = ccgi_set_relay_enable(ifenable,allslot_id); if (ret == 1) { ShowAlert(search(lpublic,"oper_succ")); } else { ShowAlert(search(lpublic,"oper_fail")); } } }
int cgiMain() { char *encry=(char *)malloc(BUF_LEN); char *str; struct list *lpublic; /*解析public.txt文件的链表头*/ struct list *lcontrol; /*解析wlan.txt文件的链表头*/ lpublic=get_chain_head("../htdocs/text/public.txt"); lcontrol=get_chain_head("../htdocs/text/control.txt"); char hsid[30]; memset(hsid,0,30); char hstype[10]; memset(hstype,0,10); cgiFormStringNoNewlines("ID",hsid,30); cgiFormStringNoNewlines("TYPE",hstype,10); if(cgiFormStringNoNewlines("UN", encry, BUF_LEN)!=cgiFormNotFound ) /*首次进入该页*/ { str=dcryption(encry); if(str==NULL) ShowErrorPage(search(lpublic,"ill_user")); /*用户非法*/ else { if(strcmp(hstype,"2")==0) ShowOptClearPage(encry,hsid,lpublic,lcontrol); else ShowOptModPage(encry,hsid,lpublic,lcontrol); } } else { cgiFormStringNoNewlines("encry_newvrrp",encry,BUF_LEN); str=dcryption(encry); if(str==NULL) ShowErrorPage(search(lpublic,"ill_user")); /*用户非法*/ else { if(strcmp(hstype,"2")==0) ShowOptClearPage(encry,hsid,lpublic,lcontrol); else ShowOptModPage(encry,hsid,lpublic,lcontrol); } } free(encry); release(lpublic); release(lcontrol); return 0; }
static int s_multiRadius_prefix_of_page( STPageInfo *pstPageInfo ) { char del_rule[10] = ""; char nodez[MAX_RADIUS_DOMAIN_LEN] = {0}; int ret = 0; FILE * fp = pstPageInfo->fp; //if file not exist,creat it and write "start" in it char buf_start[]="start\n"; fprintf(fp, "<style type=text/css>"\ "#div1{ width:58px; height:18px; border:1px solid #666666; background-color:#f9f8f7;}"\ "#div2{ width:56px; height:15px; padding-left:3px; padding-top:3px}"\ "#link{ text-decoration:none; font-size: 12px}</style>" ); fprintf(fp, "<script type=\"text/javascript\">"\ "function popMenu(objId)"\ "{"\ "var obj = document.getElementById(objId);"\ "if (obj.style.display == 'none')"\ "{"\ "obj.style.display = 'block';"\ "}"\ "else"\ "{"\ "obj.style.display = 'none';"\ "}"\ "}"\ "</script>"); if( cgiFormSubmitClicked(SUBMIT_NAME) == cgiFormSuccess ) { fprintf( fp, "<script type='text/javascript'>\n" ); fprintf( fp, "window.location.href='wp_multi_radius.cgi?UN=%s';\n", pstPageInfo->encry ); fprintf( fp, "</script>\n" ); } cgiFormStringNoNewlines( "DELRULE", del_rule, 10 ); if( !strcmp(del_rule, "delete") && (pstPageInfo->iUserGroup == 0)) { cgiFormStringNoNewlines( "NODEZ", nodez, sizeof(nodez) ); ret = eag_del_radius(ccgi_connection, parameter.local_id, parameter.instance_id, nodez ); fprintf( fp, "<script type='text/javascript'>\n" ); fprintf( fp, "window.location.href='wp_multi_radius.cgi?UN=%s&plotid=%s';\n", pstPageInfo->encry ,plotid); fprintf( fp, "</script>\n" ); } return 0; }
int cgiMain() { char *encry=(char *)malloc(BUF_LEN); /*存储从wp_Frameset.cgi带入的加密字符串*/ char *str; char lan[10]; struct list *lpublic; /*解析public.txt文件的链表头*/ lpublic=get_chain_head("../htdocs/text/public.txt"); memset(lan,0,10); memset(encry,0,BUF_LEN); char Src[128]; memset(Src,0,128); if(cgiFormStringNoNewlines("UN", encry, BUF_LEN)!=cgiFormNotFound ) /*首次进入该页,lan为浏览器默认语言*/ { cgiFormStringNoNewlines("LAN", lan, 10); str=dcryption(encry); if(str==NULL) ShowErrorPage(search(lpublic,"ill_user")); /*用户非法*/ else { if(LT !=NULL) strcpy(Src,LT); else strcpy(Src,""); ShowtopFramePage(str,encry,lan,lpublic,Src); } } else /*修改select之后,lan为上次选中的语言*/ { cgiFormStringNoNewlines("en_ch",lan,10); cgiFormStringNoNewlines("encry_top", encry, BUF_LEN); str=dcryption(encry); if(str==NULL) ShowErrorPage(search(lpublic,"ill_user")); /*用户非法*/ else { if(LT !=NULL) strcpy(Src,LT); else strcpy(Src,""); ShowtopFramePage(str,encry,lan,lpublic,Src); } } free(encry); release(lpublic); return 0; }
void modifyprivilege_hand(struct list *lpublic, struct list *lsystem) { char na[N],apri[N]; int ret=10; int status; memset(na,0,N); /*清空临时变量*/ memset(apri,0,N); cgiFormStringNoNewlines("a_name", na, N); cgiFormStringNoNewlines("privilege",apri,N); char *command = (char *)malloc(PATH_LENG); /*修改权限参数*/ memset(command, 0, PATH_LENG); strcat(command,"userrole.sh"); strcat(command," "); strcat(command,na); strcat(command," "); strcat(command,apri); if(strcmp(na,"")!=0) { if(checkuser_exist(na)==0) { if(strcmp(na,"admin")!=0) { /***********************************************************************************/ /*调用修改权限脚本*/ status = system(command); ret = WEXITSTATUS(status); if(ret == 0) ShowAlert(search(lpublic,"oper_succ")); else ShowAlert(search(lpublic,"oper_fail")); /***********************************************************************************/ } else { ShowAlert(search(lsystem,"admin_pri")); } } else { ShowAlert(search(lsystem,"user_not_exist")); } } else { ShowAlert(search(lpublic,"name_not_null")); } free(command); }
int cgiMain() { char encry[BUF_LEN] = { 0 }; char instance_id[10] = { 0 }; char flag[5] = { 0 }; /*fla=="1",表示上一页为wp_radiolis.cgi,否则上一页为wp_wtpdta.cgi*/ char *str = NULL; char ID[5] = { 0 }; char WlanID[5] = { 0 }; struct list *lpublic = NULL; /*解析public.txt文件的链表头*/ struct list *lwlan = NULL; /*解析wlan.txt文件的链表头*/ lpublic=get_chain_head("../htdocs/text/public.txt"); lwlan=get_chain_head("../htdocs/text/wlan.txt"); DcliWInit(); ccgi_dbus_init(); memset(encry,0,sizeof(encry)); memset(flag,0,sizeof(flag)); memset(ID,0,sizeof(ID)); memset(WlanID,0,sizeof(WlanID)); cgiFormStringNoNewlines("FL", flag, 5); if(cgiFormStringNoNewlines("UN", encry, BUF_LEN)!=cgiFormNotFound ) /*首次进入该页*/ { cgiFormStringNoNewlines("ID", ID, 5); cgiFormStringNoNewlines("INSTANCE_ID",instance_id,10); str=dcryption(encry); if(str==NULL) ShowErrorPage(search(lpublic,"ill_user")); /*用户非法*/ else if(cgiFormStringNoNewlines("WLAN_ID", WlanID, 5)!=cgiFormNotFound) /*从wp_wlanbla_del.cgi进入该页*/ ShowRadioWhitePage(encry,str,ID,WlanID,flag,instance_id,lpublic,lwlan); else ShowRadioWhitePage(encry,str,ID,"1",flag,instance_id,lpublic,lwlan); } else { cgiFormStringNoNewlines("encry_radiowhite",encry,BUF_LEN); cgiFormStringNoNewlines("radio_id", ID, 5); cgiFormStringNoNewlines("wlan_id", WlanID, 5); cgiFormStringNoNewlines("instance_id",instance_id,10); str=dcryption(encry); if(str==NULL) ShowErrorPage(search(lpublic,"ill_user")); /*用户非法*/ else ShowRadioWhitePage(encry,str,ID,WlanID,flag,instance_id,lpublic,lwlan); } if(strcmp(instance_id,"")==0) { memset(instance_id,0,sizeof(instance_id)); strncpy(instance_id,"0",sizeof(instance_id)-1); } release(lpublic); release(lwlan); destroy_ccgi_dbus(); return 0; }
int cgiMain() { char encry[BUF_LEN] = { 0 }; char ID[10] = { 0 }; char pno[10] = { 0 }; char *str = NULL; char instance_id[10] = { 0 }; struct list *lpublic = NULL; /*解析public.txt文件的链表头*/ struct list *lwlan = NULL; /*解析wlan.txt文件的链表头*/ instance_parameter *paraHead1 = NULL; dbus_parameter ins_para; lpublic=get_chain_head("../htdocs/text/public.txt"); lwlan=get_chain_head("../htdocs/text/wlan.txt"); DcliWInit(); ccgi_dbus_init(); memset(encry,0,sizeof(encry)); memset(ID,0,sizeof(ID)); memset(pno,0,sizeof(pno)); memset(instance_id,0,sizeof(instance_id)); if(cgiFormStringNoNewlines("UN", encry, BUF_LEN)!=cgiFormNotFound ) /*首次进入该页*/ { cgiFormStringNoNewlines("ID", ID, 10); cgiFormStringNoNewlines("PN",pno,10); cgiFormStringNoNewlines("INSTANCE_ID", instance_id, 10); } else { cgiFormStringNoNewlines("encry_conebr",encry,BUF_LEN); cgiFormStringNoNewlines("ebr_id",ID,10); cgiFormStringNoNewlines("page_no",pno,10); cgiFormStringNoNewlines("instance_id",instance_id,10); } if(strcmp(instance_id,"")==0) { list_instance_parameter(¶Head1, INSTANCE_STATE_WEB); if(paraHead1) { snprintf(instance_id,sizeof(instance_id)-1,"%d-%d-%d",paraHead1->parameter.slot_id,paraHead1->parameter.local_id,paraHead1->parameter.instance_id); } } else { get_slotID_localID_instanceID(instance_id,&ins_para); get_instance_dbus_connection(ins_para, ¶Head1, INSTANCE_STATE_WEB); } str=dcryption(encry); if(str==NULL) ShowErrorPage(search(lpublic,"ill_user")); /*用户非法*/ else ShowEbrconPage(encry,ID,instance_id,pno,paraHead1,lpublic,lwlan); release(lpublic); release(lwlan); free_instance_parameter_list(¶Head1); destroy_ccgi_dbus(); return 0; }
void Set_Master_port(int id,struct list *lpublic,struct list *lcon) { int ret; char *port_name=(char *)malloc(10); memset(port_name,0,10); cgiFormStringNoNewlines("port",port_name,10); if((strcmp(port_name,"")!=0)&&(strchr(port_name,' ')==NULL)) /*port不能为空*/ { ccgi_dbus_init(); ret=set_master_port(id,port_name); switch(ret) { case 0:ShowAlert(search(lcon,"set_master_port_fail")); break; case 1:ShowAlert(search(lcon,"set_master_port_succ")); break; case -1:ShowAlert(search(lcon,"unknown_portno_format")); break; case -2:ShowAlert(search(lcon,"port_not_exist")); break; case -3:ShowAlert(search(lcon,"trunk_not_exist")); break; case -4:ShowAlert(search(lcon,"port_is_not_trunk_member")); break; case -5:ShowAlert(search(lcon,"port_is_l3")); break; case -6:ShowAlert(search(lpublic,"error")); break; } } else ShowAlert(search(lcon,"enter_port")); free(port_name); }
void Name() { char name[81]; int result = cgiFormStringNoNewlines("name", name, 81); switch (result) { case cgiFormSuccess: fprintf(cgiOut, "Name fetched, result code: cgiFormSuccess<br>\n"); break; case cgiFormTruncated: fprintf(cgiOut, "Name fetched, result code: cgiFormTruncated<br>\n"); break; case cgiFormEmpty: fprintf(cgiOut, "Name fetched, result code: cgiFormEmpty<br>\n"); break; case cgiFormNotFound: fprintf(cgiOut, "Name fetched, result code: cgiFormNotFound<br>\n"); break; case cgiFormMemory: fprintf(cgiOut, "Name fetched, result code: cgiFormMemory<br>\n"); break; default: fprintf(cgiOut, "Name fetched, unexpected result code: %d\n", result); break; } fprintf(cgiOut, "Name: %s<BR>\n", name); }
void Name() { char name[81]; cgiFormStringNoNewlines("name", name, 81); fprintf(cgiOut, "Name: "); cgiHtmlEscape(name); fprintf(cgiOut, "<BR>\n"); }
void Passwd(char *passwd) { cgiFormStringNoNewlines("passwd", passwd, 32); // fprintf(cgiOut, "Passwd: "); // cgiHtmlEscape(passwd); // fprintf(cgiOut, "<BR>\n"); }
void Name(char *name) { cgiFormStringNoNewlines("name", name, 32); // fprintf(cgiOut, "Name: "); // cgiHtmlEscape(name); // fprintf(cgiOut, "<BR>\n"); }
int cgiMain() { char encry[BUF_LEN] = { 0 }; char *str = NULL; struct list *lpublic = NULL; /*解析public.txt文件的链表头*/ struct list *lwcontrol = NULL; /*解析wcontrol.txt文件的链表头*/ struct list *lwlan = NULL; /*解析wlan.txt文件的链表头*/ lpublic=get_chain_head("../htdocs/text/public.txt"); lwcontrol=get_chain_head("../htdocs/text/wcontrol.txt"); lwlan=get_chain_head("../htdocs/text/wlan.txt"); DcliWInit(); ccgi_dbus_init(); memset(encry,0,sizeof(encry)); cgiFormStringNoNewlines("UN", encry, BUF_LEN); str=dcryption(encry); if(str==NULL) ShowErrorPage(search(lpublic,"ill_user")); /*用户非法*/ else { ShowStationPage(encry,str,lpublic,lwcontrol,lwlan); } release(lpublic); release(lwcontrol); release(lwlan); destroy_ccgi_dbus(); return 0; }
void Config_load_balance(struct list *lpublic,struct list *lcon) { int ret; char *load_balance=(char *)malloc(15); memset(load_balance,0,15); cgiFormStringNoNewlines("load_balance",load_balance,15); ccgi_dbus_init(); ret=set_load_balance(load_balance); /*mode列表:based-port|based-mac|based-ip|based-L4|mac+ip|mac+L4|ip+L4|mac+ip+L4*/ /*返回0表示失败,返回1表示成功,返回-1表示there no trunk exist*/ /*返回-2表示load-balance Mode same to corrent mode*/ /*返回-3表示设备不支持这种模式*/ switch(ret) { case 0:ShowAlert(search(lcon,"con_load_balance_fail")); break; case 1:ShowAlert(search(lcon,"con_load_balance_succ")); break; case -1:ShowAlert(search(lcon,"no_trunk")); break; case -2:ShowAlert(search(lcon,"same_load_balance")); break; //kehao add 2011-04-26 ///////////////////////////////////////////////////// case -3:ShowAlert(search(lcon,"device_unsupported_balance_mode")); break; ///////////////////////////////////////////////////// } free(load_balance); }
/* * Function: processAddForm * Parameters: (void) * Returns: int * * This function is used to process the data that was entered in the adding * form. The function allocates memory and if it fails memory allocation * error will be printed to the user. It also checks there were no errors * in new artists id and if there are errors the appropriate message will * be shown to the user */ static Boolean processAddForm(int *errors, artistNode_t * formdata) { int result = 0; int size = -1; /* Check arguments */ if (errors == NULL || formdata == NULL) { return FALSE; } /* Get artist name */ result = cgiFormStringSpaceNeeded("artname", &size); if (result != cgiFormSuccess) { errors[0] = E_FORM; } else if (size > MAXLEN_ARTISTNAME + 1) { errors[0] = E_TOOBIG; } else { formdata->name = malloc(sizeof(char) * size); if (formdata->name == NULL) { errors[0] = E_MALLOC_FAILED; } else { result = cgiFormStringNoNewlines("artname", formdata->name, size); if (result != cgiFormSuccess) { errors[0] = E_FORM; } else if (checkString2(formdata->name) == FALSE) { errors[0] = E_INVALID_PARAM; } else { /* check whether artist already exists */ { /*pointer to list of artists */ int *allArtists = getArtists(); int i; /*counter */ for (i = 0; allArtists[i] != LAST_ID_IN_ARRAY; i++) { char *artistName = getArtistName(allArtists[i]); if (strcmp(artistName, formdata->name) == 0) { /*artist added is 'the same' as another in database */ errors[0] = ALREADY_ADDED; } free(artistName); } free(allArtists); } } } } if (errors[0] != E_NOERROR) { return FALSE; } return TRUE; }
void handlePlainText() { char value[32]; memset(value, '\0', sizeof(value)); cgiFormStringNoNewlines("name", value, 32); fprintf(cgiOut, "<BR>Name: <B><font color=\"blue\">"); cgiHtmlEscape(value); fprintf(cgiOut, "</font></B><BR>\n"); setName(value); }
void DeleteV3user(DBusConnection *select_connection,struct list *lpublic,struct list *lsnmpd) { int ret = AC_MANAGE_DBUS_ERROR; char V3userName[25] = { 0 }; int ret_c = 0; memset(V3userName,0,sizeof(V3userName)); cgiFormStringNoNewlines("V3userName", V3userName, 25); if(strcmp(V3userName,"")) { ret_c = check_snmp_name(V3userName, 0); if((ret_c == -2)||(ret_c == -1)) { ShowAlert(search(lsnmpd,"v3user_lenth_illegal")); return; } else if(ret_c == -3) { ShowAlert(search(lsnmpd,"v3user_illegal1")); return; } else if(ret_c == -4) { ShowAlert(search(lsnmpd,"v3user_illegal2")); return; } else if(ret_c == -5) { ShowAlert(search(lsnmpd,"v3user_illegal3")); return; } ret = ac_manage_config_snmp_del_v3user(select_connection, V3userName); if(AC_MANAGE_SUCCESS == ret) { ShowAlert(search(lsnmpd,"delete_v3user_succ")); } else if(AC_MANAGE_SERVICE_ENABLE == ret) { ShowAlert(search(lsnmpd,"disable_snmp_service")); } else if(AC_MANAGE_CONFIG_NONEXIST == ret) { ShowAlert(search(lsnmpd,"v3user_not_exist")); } else if(AC_MANAGE_DBUS_ERROR == ret) { ShowAlert(search(lsnmpd,"delete_v3user_fail")); } else { ShowAlert(search(lsnmpd,"delete_v3user_fail")); } } }
void ShowIPaddr(struct list *lcontrol,struct list *lpublic,char*addn) { if(checkuser_group(addn)==0) { char * status = (char *)malloc(10); memset(status,0,10); cgiFormStringNoNewlines("State",status,10); char allslot_str[10] = {0}; int allslot_id = 0; cgiFormStringNoNewlines("allslot",allslot_str,sizeof(allslot_str)); allslot_id = atoi(allslot_str); int sflag = -1; ccgi_dbus_init(); if(!strcmp(status,"start")) { sflag=ip_dhcp_server_enable("enable",allslot_id); if(sflag==1) { ShowAlert(search(lcontrol,"DHCP_STAT1")); } else { ShowAlert(search(lcontrol,"DHCP_STAT10")); } } else { sflag=ip_dhcp_server_enable("disable",allslot_id); if(sflag==1) { ShowAlert(search(lcontrol,"DHCP_STAT0")); } else { ShowAlert(search(lcontrol,"DHCP_STAT01")); } } free(status); } }
int cgiMain() { char encry[BUF_LEN] = { 0 }; char *str = NULL; char wlan_id[10] = { 0 }; char macChoice[10] = { 0 }; struct list *lpublic = NULL; /*解析public.txt文件的链表头*/ struct list *lwlan = NULL; /*解析wlan.txt文件的链表头*/ lpublic=get_chain_head("../htdocs/text/public.txt"); lwlan=get_chain_head("../htdocs/text/wlan.txt"); DcliWInit(); ccgi_dbus_init(); memset(encry,0,sizeof(encry)); memset(wlan_id,0,sizeof(wlan_id)); memset(macChoice,0,sizeof(macChoice)); if(cgiFormStringNoNewlines("UN", encry, BUF_LEN)!=cgiFormNotFound ) /*首次进入该页*/ { str=dcryption(encry); if(str==NULL) ShowErrorPage(search(lpublic,"ill_user")); /*用户非法*/ else ShowWlannewPage(encry,"1","none",lpublic,lwlan); } else { cgiFormStringNoNewlines("wlan_id",wlan_id,10); cgiFormStringNoNewlines("wlan_type",macChoice,10); cgiFormStringNoNewlines("encry_newwlan",encry,BUF_LEN); str=dcryption(encry); if(str==NULL) ShowErrorPage(search(lpublic,"ill_user")); /*用户非法*/ else ShowWlannewPage(encry,wlan_id,macChoice,lpublic,lwlan); } release(lpublic); release(lwlan); destroy_ccgi_dbus(); return 0; }
void Add_Delete_port(int id,char *flag,struct list *lpublic,struct list *lcon) { int ret; char *port_name=(char *)malloc(10); memset(port_name,0,10); cgiFormStringNoNewlines("port",port_name,10); if((strcmp(port_name,"")!=0)&&(strchr(port_name,' ')==NULL)) /*port不能为空*/ { ccgi_dbus_init(); ret=add_delete_trunk_port(id,flag,port_name); switch(ret) { case 0:{ if(strcmp(flag,"add")==0) ShowAlert(search(lcon,"add_port_fail")); else ShowAlert(search(lcon,"delete_port_fail")); break; } case 1:{ if(strcmp(flag,"add")==0) ShowAlert(search(lcon,"add_port_succ")); else ShowAlert(search(lcon,"delete_port_succ")); break; } case -1:ShowAlert(search(lcon,"unknown_portno_format")); break; case -2:ShowAlert(search(lcon,"port_not_exist")); break; case -3:ShowAlert(search(lcon,"trunk_not_exist")); break; case -4:ShowAlert(search(lcon,"port_is_trunk_member")); break; case -5:ShowAlert(search(lcon,"port_is_not_trunk_member")); break; case -6:ShowAlert(search(lcon,"trunk_port_full")); break; case -7:ShowAlert(search(lcon,"port_own_other_trunk")); break; case -8:ShowAlert(search(lcon,"port_is_l3")); break; case -9:ShowAlert(search(lcon,"port_is_master")); break; case -10:ShowAlert(search(lpublic,"error")); break; } } else ShowAlert(search(lcon,"enter_port")); free(port_name); }
int cgiMain() { char *encry=(char *)malloc(BUF_LEN); char *str; struct list *lpublic; /*解析public.txt文件的链表头*/ struct list *lLicense; /*解析wlan.txt文件的链表头*/ struct list *lsystem; /*解析wlan.txt文件的链表头*/ memset(encry,0,BUF_LEN); lpublic=get_chain_head("../htdocs/text/public.txt"); lLicense=get_chain_head("../htdocs/text/authentication.txt"); lsystem=get_chain_head("../htdocs/text/system.txt"); if(cgiFormStringNoNewlines("UN", encry, BUF_LEN)!=cgiFormNotFound ) /*首次进入该页*/ { str=dcryption(encry); if(str==NULL) ShowErrorPage(search(lpublic,"ill_user")); /*用户非法*/ else ShowPortalFtpPage(encry,lpublic,lLicense,lsystem); } else { cgiFormStringNoNewlines("encry_newwtp",encry,BUF_LEN); str=dcryption(encry); if(str==NULL) ShowErrorPage(search(lpublic,"ill_user")); /*用户非法*/ else ShowPortalFtpPage(encry,lpublic,lLicense,lsystem); } free(encry); release(lpublic); release(lLicense); release(lsystem); return 0; }
int cgiMain() { char encry[BUF_LEN] = { 0 }; char ID[10] = { 0 }; char instance_id[10] = { 0 }; char *str = NULL; struct list *lpublic = NULL; /*解析public.txt文件的链表头*/ struct list *lwlan = NULL; /*解析wlan.txt文件的链表头*/ lpublic=get_chain_head("../htdocs/text/public.txt"); lwlan=get_chain_head("../htdocs/text/wlan.txt"); DcliWInit(); ccgi_dbus_init(); memset(encry,0,sizeof(encry)); memset(ID,0,sizeof(ID)); memset(instance_id,0,sizeof(instance_id)); cgiFormStringNoNewlines("INSTANCE_ID", instance_id, 10); if(cgiFormStringNoNewlines("UN", encry, BUF_LEN)!=cgiFormNotFound ) /*首次进入该页*/ { cgiFormStringNoNewlines("ID", ID, 10); } else { cgiFormStringNoNewlines("encry_wtpdta",encry,BUF_LEN); cgiFormStringNoNewlines("wtpid",ID,10); } str=dcryption(encry); if(str==NULL) ShowErrorPage(search(lpublic,"ill_user")); /*用户非法*/ else ShowWtpdtaPage(encry,str,ID,instance_id,lpublic,lwlan); release(lpublic); release(lwlan); destroy_ccgi_dbus(); return 0; }
int cgiMain() { char encry[BUF_LEN] = { 0 }; char *str = NULL; char AddFlag[5] = { 0 }; char old_name[25] = { 0 }; char ComID[10] = { 0 }; int add_flag = 1; /*1表示添加共同体,0表示修改共同体*/ struct list *lpublic = NULL; /*解析public.txt文件的链表头*/ struct list *lsnmpd = NULL; /*解析wlan.txt文件的链表头*/ lpublic=get_chain_head("../htdocs/text/public.txt"); lsnmpd=get_chain_head("../htdocs/text/snmpd.txt"); DcliWInit(); ccgi_dbus_init(); memset(encry,0,sizeof(encry)); memset(AddFlag,0,sizeof(AddFlag)); memset(old_name,0,sizeof(old_name)); memset(ComID,0,sizeof(ComID)); cgiFormStringNoNewlines("AddFlag", AddFlag, BUF_LEN); if(strcmp(AddFlag,"0") == 0) add_flag = 0; if(cgiFormStringNoNewlines("UN", encry, BUF_LEN)!=cgiFormNotFound ) /*首次进入该页*/ { cgiFormStringNoNewlines("OldCommunityName", old_name, 25); cgiFormStringNoNewlines("CommunityID", ComID, 10); } else { cgiFormStringNoNewlines("encry_add_community",encry,BUF_LEN); cgiFormStringNoNewlines("old_name", old_name, 25); cgiFormStringNoNewlines("ComID", ComID, 10); } str=dcryption(encry); if(str==NULL) ShowErrorPage(search(lpublic,"ill_user")); /*用户非法*/ else ShowAddCommunityPage(encry,add_flag,old_name,ComID,lpublic,lsnmpd); release(lpublic); release(lsnmpd); destroy_ccgi_dbus(); return 0; }
void DeleteView(DBusConnection *select_connection,struct list *lpublic,struct list *lsnmpd) { int ret = AC_MANAGE_DBUS_ERROR; char ViewName[25] = { 0 }; memset(ViewName,0,sizeof(ViewName)); cgiFormStringNoNewlines("ViewName", ViewName, 25); if(strcmp(ViewName,"")) { ret = ac_manage_config_snmp_view(select_connection, ViewName, 0); if(AC_MANAGE_SUCCESS == ret) { ShowAlert(search(lsnmpd,"delete_view_succ")); } else if(AC_MANAGE_INPUT_TYPE_ERROR == ret) { ShowAlert(search(lsnmpd,"input_type_error")); } else if(AC_MANAGE_CONFIG_RELEVANCE == ret) { ShowAlert(search(lsnmpd,"delete_group_first")); } else if(AC_MANAGE_DBUS_ERROR == ret) { ShowAlert(search(lsnmpd,"delete_view_fail")); } else if(AC_MANAGE_SERVICE_ENABLE == ret) { ShowAlert(search(lsnmpd,"disable_snmp_service")); } else if(AC_MANAGE_CONFIG_NONEXIST == ret) { ShowAlert(search(lsnmpd,"view_not_exist")); } else { ShowAlert(search(lsnmpd,"delete_view_fail")); } } }