4 Copyright (C) 2006-2008 Jonathan Zarate
15 #include <sys/reboot.h>
17 #define NVRAMCMD "nvram"
19 void wi_uploadsplash(char *url
, int len
, char *boundary
)
33 error
= "Error reading file";
36 if (!skip_header(&len
)) {
40 if ((len
< 64) || (len
> (NVRAM_SPACE
* 2))) {
41 error
= "Invalid file";
45 if ((buf
= malloc(len
)) == NULL
) {
46 error
= "Not enough memory";
50 n
= web_read(buf
, len
);
52 n
= n
- strlen(boundary
)-6;
53 syslog(LOG_INFO
, "boundary %s, len %d", boundary
, strlen(boundary
));
54 if ((p
= nvram_get("NC_DocumentRoot")) == NULL
) p
= "/tmp/splashd";
55 sprintf(tmp
, "%s/splash.html", p
);
56 if (f_write(tmp
, buf
, n
, 0, 0600) != n
) {
57 error
= "Error writing temporary file";
61 nvram_set_file("NC_SplashFile", tmp
, 8192);
69 if (error
!= NULL
) resmsg_set(error
);
73 void wo_uploadsplash(char *url
)
76 redirect("/new-splashd.asp");
80 parse_asp("error.asp");