Ignore:
Timestamp:
Jul 27, 2011, 5:37:12 PM (14 years ago)
Author:
Herwig Bauernfeind
Message:

Update Samba 3.3 to 3.3.16 (security update)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/samba-3.3.x/source/web/cgi.c

    r411 r614  
    2020#include "includes.h"
    2121#include "web/swat_proto.h"
     22#include "secrets.h"
    2223
    2324#define MAX_VARIABLES 10000
     
    4344static char *pathinfo;
    4445static char *C_user;
     46static char *C_pass;
    4547static bool inetd_server;
    4648static bool got_request;
     
    322324        }
    323325
    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        }
    325342        setuid(pwd->pw_uid);
    326343        if (geteuid() != pwd->pw_uid || getuid() != pwd->pw_uid) {
     
    391408                        /* Save the users name */
    392409                        C_user = SMB_STRDUP(user);
     410                        C_pass = SMB_STRDUP(user_pass);
    393411                        TALLOC_FREE(pass);
    394412                        return True;
     
    425443}
    426444
     445/***************************************************************************
     446return a ptr to the users password
     447  ***************************************************************************/
     448char *cgi_user_pass(void)
     449{
     450        return(C_pass);
     451}
    427452
    428453/***************************************************************************
Note: See TracChangeset for help on using the changeset viewer.