Ignore:
Timestamp:
May 12, 2014, 8:58:38 PM (11 years ago)
Author:
Silvan Scherrer
Message:

Samba 3.6: updated vendor to latest version

File:
1 edited

Legend:

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

    r740 r860  
    4949static char *C_user;
    5050static char *C_pass;
     51static char *C_nonce;
    5152static bool inetd_server;
    5253static bool got_request;
     
    330331
    331332        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());
    346334        }
    347335        setuid(pwd->pw_uid);
     
    457445{
    458446        return(C_pass);
     447}
     448
     449/***************************************************************************
     450return a ptr to the nonce
     451  ***************************************************************************/
     452char *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);
    459471}
    460472
Note: See TracChangeset for help on using the changeset viewer.