/*** This is a custom program for Western New England College **** Other schools will not need this ***/ #include #include "global.h" #include "custom.h" /* for date FORMAT strings */ #include #include /* Directory information. */ #include /* for stat() */ #include /* for unlink, mktmp ... */ #include "manhat-lib/shared_util.h" #include "manhat-lib/shared_potato_util.h" /* for kill_hotpotato_directory() */ #include "manhat-lib/shared_central_user.h" /* for get_central_user_info() */ #include "manhat-lib/shared_authenticate.h" #include "manhat-lib/shared_person_list.h" /* for get_user_info() */ #include "manhat-lib/shared_lock.h" #include "manhat-lib/shared_login.h" #include "manhat-lib/shared_server_locked.h" #include "manhat-lib/shared_server_string.h" #include "manhat-lib/shared_strtrm.h" #include "manhat-lib/shared_cookie.h" #include "manhat-lib/shared_encrypt.h" #include "manhat-lib/shared_access.h" #include "manhat-lib/shared_central_log.h" #include "manhat-lib/shared_user_index.h" #include "manhat-lib/shared_cs_util.h" /* for get_string_value() */ #include "manhat-lib/shared_news_util.h" /* so we can set_discussion_names() */ #define MAX_NUM_PARAM_ID 3 /*** AUTHENTICATION_SERVER_IP is a WNEC customization which may be **** found in custom.h. *** If it's not #defined there, #define it now so this program *** can compile **/ #define AUTHENTICATION_SERVER_IP "10.5.19.240" void send_report (const char *string ) { send_content_type (); puts (""); printf ("%s", "send url"); printf (""); puts (string); puts ("\r\n\n"); exit (0); } static void read_parameters (char *id[MAX_NUM_PARAM_ID], char *expire) { char tmp[MAX_ID + 1]; char *add; add = hdf_get_value(global_cgi->hdf, "CGI.RemoteAddress", 0); if(add) { if(strcmp(add, AUTHENTICATION_SERVER_IP)) send_report("Page can not be displayed"); } else send_report("Page can not be displayed"); cs_get_optional_parameter ("fac_id", id[0], MAX_ID); cs_get_optional_parameter ("std_id", id[1], MAX_ID); cs_get_optional_parameter ("emp_id", tmp, MAX_ID); if(*tmp) snprintf(id[2],MAX_ID + 1, "e%s", tmp); cs_get_optional_parameter ("expire", expire, MAX_PATH); } static void central_login(const char *username, char *key) { SESSION user; char base_dir[MAX_PATH + 1]; get_central_user_info ( username, &user, 0); /*shared_central_user.c , don't set capture flag*/ snprintf(base_dir, MAX_PATH + 1, "../%s", USERS_DIR); create_new_key (&user, base_dir, key, MAX_KEY_EXPIRE); /*shared_login.c */ /* cs_set_event_msg () sets up the log_event.* strings used to write the central log */ if(!cs_set_event_msg()) /* shared_cs_util.c */ cs_critical_error(ERR_CANT_GET_EVENT_STRING, "in central_login()"); /* shared_cs_util.c */ // write_central_log(username, hdf_get_value(global_cgi->hdf, "log_event.successful_login",""), // hdf_get_value(global_cgi->hdf, "log_event.from_auth_server",""),0); /* shared_central_log.c */ delete_central_user_keys(username); /* shared_authenticate.c */ } void init(char *data[MAX_NUM_PARAM_ID], int len, int max) { int i; for(i =0;i