Changeset 614 for branches/samba-3.3.x/source/web/cgi.c
- Timestamp:
- Jul 27, 2011, 5:37:12 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/samba-3.3.x/source/web/cgi.c
r411 r614 20 20 #include "includes.h" 21 21 #include "web/swat_proto.h" 22 #include "secrets.h" 22 23 23 24 #define MAX_VARIABLES 10000 … … 43 44 static char *pathinfo; 44 45 static char *C_user; 46 static char *C_pass; 45 47 static bool inetd_server; 46 48 static bool got_request; … … 322 324 } 323 325 324 setuid(0); 326 C_user = SMB_STRDUP(user); 327 328 if (!setuid(0)) { 329 C_pass = secrets_fetch_generic("root", "SWAT"); 330 if (C_pass == NULL) { 331 char *tmp_pass = NULL; 332 tmp_pass = generate_random_str(16); 333 if (tmp_pass == NULL) { 334 printf("%sFailed to create random nonce for " 335 "SWAT session\n<br>%s\n", head, tail); 336 exit(0); 337 } 338 secrets_store_generic("root", "SWAT", tmp_pass); 339 C_pass = SMB_STRDUP(tmp_pass); 340 } 341 } 325 342 setuid(pwd->pw_uid); 326 343 if (geteuid() != pwd->pw_uid || getuid() != pwd->pw_uid) { … … 391 408 /* Save the users name */ 392 409 C_user = SMB_STRDUP(user); 410 C_pass = SMB_STRDUP(user_pass); 393 411 TALLOC_FREE(pass); 394 412 return True; … … 425 443 } 426 444 445 /*************************************************************************** 446 return a ptr to the users password 447 ***************************************************************************/ 448 char *cgi_user_pass(void) 449 { 450 return(C_pass); 451 } 427 452 428 453 /***************************************************************************
Note:
See TracChangeset
for help on using the changeset viewer.