Changeset 860 for vendor/current/source3/web
- Timestamp:
- May 12, 2014, 8:58:38 PM (11 years ago)
- Location:
- vendor/current/source3/web
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
vendor/current/source3/web/cgi.c
r740 r860 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; … … 330 331 331 332 if (!setuid(0)) { 332 C_pass = secrets_fetch_generic("root", "SWAT"); 333 if (C_pass == NULL) { 334 char *tmp_pass = NULL; 335 tmp_pass = generate_random_password(talloc_tos(), 336 16, 16); 337 if (tmp_pass == NULL) { 338 printf("%sFailed to create random nonce for " 339 "SWAT session\n<br>%s\n", head, tail); 340 exit(0); 341 } 342 secrets_store_generic("root", "SWAT", tmp_pass); 343 C_pass = SMB_STRDUP(tmp_pass); 344 TALLOC_FREE(tmp_pass); 345 } 333 C_pass = SMB_STRDUP(cgi_nonce()); 346 334 } 347 335 setuid(pwd->pw_uid); … … 457 445 { 458 446 return(C_pass); 447 } 448 449 /*************************************************************************** 450 return a ptr to the nonce 451 ***************************************************************************/ 452 char *cgi_nonce(void) 453 { 454 const char *head = "Content-Type: text/html\r\n\r\n<HTML><BODY><H1>SWAT installation Error</H1>\n"; 455 const char *tail = "</BODY></HTML>\r\n"; 456 C_nonce = secrets_fetch_generic("root", "SWAT"); 457 if (C_nonce == NULL) { 458 char *tmp_pass = NULL; 459 tmp_pass = generate_random_password(talloc_tos(), 460 16, 16); 461 if (tmp_pass == NULL) { 462 printf("%sFailed to create random nonce for " 463 "SWAT session\n<br>%s\n", head, tail); 464 exit(0); 465 } 466 secrets_store_generic("root", "SWAT", tmp_pass); 467 C_nonce = SMB_STRDUP(tmp_pass); 468 TALLOC_FREE(tmp_pass); 469 } 470 return(C_nonce); 459 471 } 460 472 -
vendor/current/source3/web/swat.c
r746 r860 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")) { -
vendor/current/source3/web/swat_proto.h
r615 r860 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.