Ignore:
Timestamp:
Jul 28, 2011, 4:21:02 PM (14 years ago)
Author:
Herwig Bauernfeind
Message:

Samba 3.5: Update vendor to version 3.5.10

File:
1 edited

Legend:

Unmodified
Added
Removed
  • vendor/current/source3/web/cgi.c

    r594 r615  
    2020#include "includes.h"
    2121#include "web/swat_proto.h"
     22#include "secrets.h"
     23#include "../lib/util/util.h"
    2224
    2325#define MAX_VARIABLES 10000
     
    4345static char *pathinfo;
    4446static char *C_user;
     47static char *C_pass;
    4548static bool inetd_server;
    4649static bool got_request;
     
    321324        }
    322325
    323         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(talloc_tos(), 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                        TALLOC_FREE(tmp_pass);
     341                }
     342        }
    324343        setuid(pwd->pw_uid);
    325344        if (geteuid() != pwd->pw_uid || getuid() != pwd->pw_uid) {
     
    389408                        /* Save the users name */
    390409                        C_user = SMB_STRDUP(user);
     410                        C_pass = SMB_STRDUP(user_pass);
    391411                        TALLOC_FREE(pass);
    392412                        return True;
     
    423443}
    424444
     445/***************************************************************************
     446return a ptr to the users password
     447  ***************************************************************************/
     448char *cgi_user_pass(void)
     449{
     450        return(C_pass);
     451}
    425452
    426453/***************************************************************************
Note: See TracChangeset for help on using the changeset viewer.