Esempio n. 1
0
void
// do_upgrade_cgi(char *url, FILE *stream)
do_upgrade_cgi(struct mime_handler *handler, char *url, webs_t streamm, char *query)	// jimmy,
								// https,
								// 8/6/2003
{
#ifndef ANTI_FLASH
	fprintf(stderr, "do post\n");
	if (upgrade_ret)
		do_ej(handler, "Fail_u_s.asp", stream, NULL);
	else
		do_ej(handler, "Success_u_s.asp", stream, NULL);
	fprintf(stderr, "websdone\n");

	websDone(stream, 200);
	fprintf(stderr, "reboot\n");

	/*
	 * Reboot if successful 
	 */
	if (upgrade_ret == 0) {
		sleep(5);
		sys_reboot();
	}
#else
	do_ej(handler, "Fail_u_s.asp", stream, NULL);
	websDone(stream, 200);
#endif
}
Esempio n. 2
0
void ej_show_index_setting(webs_t wp, int argc, char_t ** argv)
{
	char *type;

	type = GOZILA_GET(wp, "wan_proto");
	if (type == NULL)
		type = nvram_safe_get("wan_proto");
#ifdef HAVE_DSL_CPE_CONTROL
	do_ej(NULL, "index_atm.asp", wp, NULL);
#endif
	char ejname[32];
	snprintf(ejname, 31, "index_%s.asp", type);
	do_ej(NULL, ejname, wp, NULL);
}
Esempio n. 3
0
void ej_show_status_setting(webs_t wp, int argc, char_t ** argv)
{

	do_ej(NULL, "Status_Router1.asp", wp, NULL);

	return;
}
Esempio n. 4
0
void ej_atmsettings(webs_t wp, int argc, char_t ** argv)
{
#ifdef HAVE_DSL_CPE_CONTROL
	char ejname[32];
	snprintf(ejname, 31, "index_%s_atm.asp", argv[0]);
	do_ej(NULL, ejname, wp, NULL);
#endif
}
Esempio n. 5
0
File: ej.c Progetto: jhbsz/LC4
void 
als_do_ej(char *file , webs_t stream , ...)
{
    char path[512],pattern[512];
    char p_1[8]="1",p_2[8]="0";

    sscanf(file,"%[^?]?%s",path,pattern);
    sscanf(pattern,"%[^&]&%s",p_1,p_2);

    do_ej(&path,stream,p_1,p_2,"");
}
Esempio n. 6
0
// do_upload
// do the image uploading.
// return: void
//
int do_upload_pre(FILE * stream, int upload_len, int upload_type)
{
	int status = WEB_STS_UPLOAD;
	httpd2sysmonitor_sysledCtrol(SYSLED_STS_BUSY);
	glbUploadStatus = upLoadImage(stream, upload_len, upload_type, &imagePtr, &imageType, &imageLen, &fNeedReset);
	glbUploadMode = upload_type;
	if (glbUploadStatus != UPLOAD_OK)     // processes are not killed.  no filename...
	{
		http2dbs_writeOptlog(-1, "upgrading firmware image");
		do_ej("/webs/uploadinfo.html", stream);
		status = WEB_STS_ERROR;
		httpd2sysmonitor_sysledCtrol(SYSLED_STS_NORMAL);
	}
	return status;
}
Esempio n. 7
0
File: wl.c Progetto: jhbsz/LC4
int
ej_wlv_sec_show_setting(int eid, INPUT *input, int argc, char_t **argv)
{
    char buf_sec[TMP_LEN], buf_if[TMP_LEN], buf_vif[TMP_LEN];
    int if_idx, vif_idx, num;
    char *secmode = NULL;
    INPUT *tmp;


    /* Get physical interface index */
    if (ejArgs(argc, argv, "%d %d", &if_idx, &vif_idx) < 2) {
        FCGI_LOG("Insufficient args");
        return FALSE;
    }
    num = atoi(nvram_safe_get("wlv_rule_num"));

    /* Get security mode rule */
    snprintf(buf_if, TMP_LEN, "wl%d_ssid%d_secmode" , if_idx, vif_idx);

    if ((tmp = CGI_Find_Parameter(input, buf_if))) {
       secmode = tmp->val;
    }

    if (!secmode || !*secmode) {
        snprintf(buf_if, TMP_LEN, "wl%d_sec_rule", if_idx);
        ezplib_get_attr_val(buf_if, vif_idx, "secmode", buf_sec,
                    TMP_LEN, EZPLIB_USE_CLI);
    } else{
        sprintf(buf_sec, "%s", secmode);
    }
    /*----------------
    buf_sec : security mode
    buf_if : interface index
    buf_vif : ssid index
    -----------------*/
    snprintf(buf_if, TMP_LEN, "%d", if_idx);
    snprintf(buf_vif, TMP_LEN, "%d", vif_idx);
    if (!strcmp(buf_sec, "wep")) {
        do_ej("wlv_sec_wep.asp", input, buf_if, buf_vif, "");
    } else if (!strcmp(buf_sec, "psk")) {
        do_ej("wlv_sec_psk.asp", input, buf_if, buf_vif, "");
    } else if (!strcmp(buf_sec, "wpa")) {
        do_ej("wlv_sec_wpa.asp", input, buf_if, buf_vif, "");
    } else if (!strcmp(buf_sec, "psk2")) {
        do_ej("wlv_sec_psk2.asp", input, buf_if, buf_vif, "");
    } else if (!strcmp(buf_sec, "wpa2")) {
        do_ej("wlv_sec_wpa2.asp", input, buf_if, buf_vif, "");
    }

    if (appmgr_check("guest_lan") && ( vif_idx == num - 1 )) {
            do_ej("guest_lan_setting.asp", input, buf_if, buf_vif, "");
    }
    return 0;
}
Esempio n. 8
0
File: upgrade.c Progetto: jhbsz/LC4
void
do_upgrade_cgi(char *url, webs_t wp, ...)
{

    if (upgrade_type == FIRMWARE) { /* FIRMWARE. */
        if (upgrade_result == 1) {
            refuse_request = 0;
            do_ej("resp_upgrade_fail.asp", wp, "");
            websDone(wp, 200);
            wfflush(wp);
            wfclose(wp);
            sleep(5);
#if defined(PLATFORM_AXA)
            system("ezp-i2c gauge host booting");
#endif
            system("ifconfig br0 down");
            system("ifconfig ra0 down");
            system("ifconfig apcli0 down");
            system("ifconfig vlan1 down");
            system("ifconfig vlan2 down");
            system("ifconfig eth2 down");
            reboot(RB_AUTOBOOT);
#if defined(PLATFORM_LIS) || defined(PLATFORM_AXA)
        } else if (upgrade_result == 2) {
            printf("upgrade_result=2\n");
            refuse_request = 0;
            do_ej("resp_upgrade_low_power.asp", wp, "");
            websDone(wp, 200);
            wfflush(wp);
            reboot(RB_AUTOBOOT);
#endif
        } else {
            /* Reboot if successful. */
            do_ej("/tmp/resp_upgrade_success.asp", wp, "");
            websDone(wp, 200);
	    /* Seprate reboot from busybox, and put it into tmp */
            /* EZP
             * It will immediately restart the router. So we can't 
             * wait the processing finish and close the connection
             * socket. */
            wfflush(wp);
            wfclose(wp);
            /* Wait 5 seconds and do reboot directly from the system call. */
#if defined(PLATFORM_AXA)
            system("/tmp/ezp-i2c gauge host booting");
#endif
            sleep(5);
            reboot(RB_AUTOBOOT);
//            exit(1);
        }
    }
    else if (upgrade_type == CONFIG) { /* Configuration.*/
        if (upgrade_result) {
            refuse_request = 0;
            do_ej("resp_fail.asp", wp, "");
            websDone(wp, 200);
        } else {
            nvram_commit();
            do_ej("resp_reboot_wait.asp", wp, "");
            websDone(wp, 200);
	    /* Seprate reboot from busybox, and put it into tmp */
#if defined(PLATFORM_AXA)
            system("ezp-i2c gauge host booting");
#endif
            system("reboot");
        }
    }
    else { /* Unknown upgrade type */
            refuse_request = 0;
            do_ej("resp_unknown_fail.asp", wp, "");
            websDone(wp, 200);
    }

}