Ignore:
Timestamp:
Nov 24, 2016, 1:14:11 PM (9 years ago)
Author:
Silvan Scherrer
Message:

Samba Server: update vendor to version 4.4.3

File:
1 edited

Legend:

Unmodified
Added
Removed
  • vendor/current/source4/param/secrets.c

    r740 r988  
    2626#include "param/param.h"
    2727#include "system/filesys.h"
    28 #include "lib/util/tdb_wrap.h"
     28#include "lib/tdb_wrap/tdb_wrap.h"
    2929#include "lib/ldb-samba/ldb_wrap.h"
    3030#include <ldb.h>
     
    3434
    3535/**
    36  * Use a TDB to store an incrementing random seed.
    37  *
    38  * Initialised to the current pid, the very first time Samba starts,
    39  * and incremented by one each time it is needed. 
    40  *
    41  * @note Not called by systems with a working /dev/urandom.
    42  */
    43 static void get_rand_seed(struct tdb_wrap *secretsdb, int *new_seed)
    44 {
    45         *new_seed = getpid();
    46         if (secretsdb != NULL) {
    47                 tdb_change_int32_atomic(secretsdb->tdb, "INFO/random_seed", new_seed, 1);
    48         }
    49 }
    50 
    51 /**
    52  * open up the secrets database
    53  */
    54 struct tdb_wrap *secrets_init(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx)
    55 {
    56         char *fname;
    57         uint8_t dummy;
    58         struct tdb_wrap *tdb;
    59 
    60         fname = private_path(mem_ctx, lp_ctx, "secrets.tdb");
    61 
    62         tdb = tdb_wrap_open(mem_ctx, fname, 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
    63 
    64         if (!tdb) {
    65                 DEBUG(0,("Failed to open %s\n", fname));
    66                 talloc_free(fname);
    67                 return NULL;
    68         }
    69         talloc_free(fname);
    70 
    71         /**
    72          * Set a reseed function for the crypto random generator
    73          *
    74          * This avoids a problem where systems without /dev/urandom
    75          * could send the same challenge to multiple clients
    76          */
    77         set_rand_reseed_callback((void (*) (void *, int *))get_rand_seed, tdb);
    78 
    79         /* Ensure that the reseed is done now, while we are root, etc */
    80         generate_random_buffer(&dummy, sizeof(dummy));
    81 
    82         return tdb;
    83 }
    84 
    85 /**
    8636  connect to the secrets ldb
    8737*/
     
    8939                                        struct loadparm_context *lp_ctx)
    9040{
    91         return ldb_wrap_connect(mem_ctx, NULL, lp_ctx, lpcfg_secrets_url(lp_ctx),
     41        return ldb_wrap_connect(mem_ctx, NULL, lp_ctx, "secrets.ldb",
    9242                               NULL, NULL, 0);
    9343}
Note: See TracChangeset for help on using the changeset viewer.