int autheph_check_from1(struct sip_msg *_m, char *_username) { str susername; if (_m == NULL || _username == NULL) { LM_ERR("invalid parameters\n"); return CHECK_ERROR; } if (get_str_fparam(&susername, _m, (fparam_t*)_username) < 0) { LM_ERR("failed to get username value\n"); return CHECK_ERROR; } if (susername.len == 0) { LM_ERR("invalid username parameter - empty value\n"); return CHECK_ERROR; } return check_from(_m, &susername); }
int autheph_check_from0(struct sip_msg *_m) { str username = {0, 0}; if (eph_auth_api.pre_auth == NULL) { LM_ERR("autheph_check_from() with no username parameter " "cannot be used without the auth module\n"); return CHECK_ERROR; } if (_m == NULL) { LM_ERR("invalid parameters\n"); return CHECK_ERROR; } if (get_cred(_m, &username) < 0) { LM_ERR("call autheph_(check|proxy|www) before calling " " check_from() with no username parameter\n"); return CHECK_ERROR; } return check_from(_m, &username); }
int cgiMain() { int act; int ret; act = check_from(); switch (act) { case -1: do_error("用户名或密码错误"); break; case 0: if (auth_check() < 0) { do_error("用户名或密码错误"); return 0; } show_basic_page(); break; case 1: handle_basic(); break; case 2: handle_security(); break; case 3: ret = what_action(); if (ret == 0) reboot(LINUX_REBOOT_CMD_RESTART); else if (ret == 1) show_cdev_page(); break; case 4: handle_cdev(); break; case 5: handle_breq(); break; case 6: handle_scene(); break; case 7: handle_slnk(); break; case 128: reboot(LINUX_REBOOT_CMD_RESTART); break; default: break; } return 0; }