Changeset 862 for trunk/server/source3/web
- Timestamp:
- May 13, 2014, 11:39:04 AM (11 years ago)
- Location:
- trunk/server
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/server
- Property svn:mergeinfo changed
/vendor/current merged: 860
- Property svn:mergeinfo changed
-
trunk/server/source3/web/cgi.c
r745 r862 49 49 static char *C_user; 50 50 static char *C_pass; 51 static char *C_nonce; 51 52 static bool inetd_server; 52 53 static bool got_request; … … 331 332 332 333 if (!setuid(0)) { 333 C_pass = secrets_fetch_generic("root", "SWAT"); 334 if (C_pass == NULL) { 335 char *tmp_pass = NULL; 336 tmp_pass = generate_random_password(talloc_tos(), 337 16, 16); 338 if (tmp_pass == NULL) { 339 printf("%sFailed to create random nonce for " 340 "SWAT session\n<br>%s\n", head, tail); 341 exit(0); 342 } 343 secrets_store_generic("root", "SWAT", tmp_pass); 344 C_pass = SMB_STRDUP(tmp_pass); 345 TALLOC_FREE(tmp_pass); 346 } 334 C_pass = SMB_STRDUP(cgi_nonce()); 347 335 } 348 336 setuid(pwd->pw_uid); … … 459 447 { 460 448 return(C_pass); 449 } 450 451 /*************************************************************************** 452 return a ptr to the nonce 453 ***************************************************************************/ 454 char *cgi_nonce(void) 455 { 456 const char *head = "Content-Type: text/html\r\n\r\n<HTML><BODY><H1>SWAT installation Error</H1>\n"; 457 const char *tail = "</BODY></HTML>\r\n"; 458 C_nonce = secrets_fetch_generic("root", "SWAT"); 459 if (C_nonce == NULL) { 460 char *tmp_pass = NULL; 461 tmp_pass = generate_random_password(talloc_tos(), 462 16, 16); 463 if (tmp_pass == NULL) { 464 printf("%sFailed to create random nonce for " 465 "SWAT session\n<br>%s\n", head, tail); 466 exit(0); 467 } 468 secrets_store_generic("root", "SWAT", tmp_pass); 469 C_nonce = SMB_STRDUP(tmp_pass); 470 TALLOC_FREE(tmp_pass); 471 } 472 return(C_nonce); 461 473 } 462 474 -
trunk/server/source3/web/swat.c
r751 r862 155 155 uint8_t token[16]; 156 156 int i; 157 char *nonce = cgi_nonce(); 157 158 158 159 token_str[0] = '\0'; … … 168 169 MD5Update(&md5_ctx, (uint8_t *)pass, strlen(pass)); 169 170 } 171 MD5Update(&md5_ctx, (uint8_t *)nonce, strlen(nonce)); 170 172 171 173 MD5Final(token, &md5_ctx); … … 267 269 printf("Expires: 0\r\n"); 268 270 } 269 printf("Content-type: text/html\r\n\r\n"); 271 printf("Content-type: text/html\r\n"); 272 printf("X-Frame-Options: DENY\r\n\r\n"); 270 273 271 274 if (!include_html("include/header.html")) { -
trunk/server/source3/web/swat_proto.h
r617 r862 33 33 char *cgi_user_name(void); 34 34 char *cgi_user_pass(void); 35 char *cgi_nonce(void); 35 36 void cgi_setup(const char *rootdir, int auth_required); 36 37 const char *cgi_baseurl(void);
Note:
See TracChangeset
for help on using the changeset viewer.