4 Copyright (C) 2006-2008 Jonathan Zarate
15 #include <sys/reboot.h>
20 #define NVRAMCMD "/tmp/nvram"
22 #define NVRAMCMD "nvram"
25 void wi_uploadsplash(char *url
, int len
, char *boundary
)
39 error
= "Error reading file";
42 if (!skip_header(&len
)) {
46 if ((len
< 64) || (len
> (NVRAM_SPACE
* 2))) {
47 error
= "Invalid file";
51 if ((buf
= malloc(len
)) == NULL
) {
52 error
= "Not enough memory";
56 n
= web_read(buf
, len
);
58 n
= n
- strlen(boundary
)-6;
59 syslog(LOG_INFO
, "boundary %s, len %d", boundary
, strlen(boundary
));
60 if ((p
= nvram_get("NC_DocumentRoot")) == NULL
) p
= "/tmp/splashd";
61 sprintf(tmp
, "%s/splash.html", p
);
62 if (f_write(tmp
, buf
, n
, 0, 0600) != n
) {
63 error
= "Error writing temporary file";
67 nvram_set_file("NC_SplashFile", tmp
, 8192);
77 if (error
!= NULL
) resmsg_set(error
);
81 void wo_uploadsplash(char *url
)
84 redirect("/new-splashd.asp");
88 parse_asp("error.asp");