Add profile-specific DOS client setup helpers and authenticated downloads
This commit is contained in:
@@ -103,6 +103,20 @@ static int process(struct mg_connection*c,const struct mg_request_info*r,json_ob
|
||||
if(!result)result=json_tokener_parse("{\"platforms\":[],\"map\":\"\"}");
|
||||
return reply(c,200,result,NULL);
|
||||
}
|
||||
/* DOS helpers: fixed profile combinations, authenticated like the UI. */
|
||||
if(!post&&!strncmp(u,"/dos/",5)){
|
||||
if(auth_default())return error(c,403,"Kennwort ändern.");
|
||||
const char *oses[]={"ms5","ms6","ms7","pc","dr","free",NULL};
|
||||
const char *clients[]={"netx","vlm","client32",NULL};
|
||||
for(int i=0;oses[i];i++)for(int j=0;clients[j];j++){
|
||||
char name[48];snprintf(name,sizeof name,"%s-%s.zip",oses[i],clients[j]);
|
||||
if(!strcmp(u+5,name)){char path[PATH_MAX];struct stat st;
|
||||
if(snprintf(path,sizeof path,"%s/dos/%s",assets,name)>=(int)sizeof path||lstat(path,&st)||!S_ISREG(st.st_mode))return error(c,404,"Installationshilfe nicht installiert.");
|
||||
mg_send_file(c,path);return 200;
|
||||
}
|
||||
}
|
||||
return error(c,404,"Unbekanntes Clientprofil.");
|
||||
}
|
||||
/* Fixed allowlist only; never interpolate a request path into the filesystem. */
|
||||
if(!post&&!strncmp(u,"/drivers/",9)){
|
||||
if(auth_default())return error(c,403,"Kennwort ändern.");
|
||||
|
||||
Reference in New Issue
Block a user