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/lib/serverid.c

    r746 r860  
    3535};
    3636
     37static struct db_context *db_ptr = NULL;
     38
     39static struct db_context *serverid_init(TALLOC_CTX *mem_ctx,
     40                                        bool readonly)
     41{
     42        db_ptr = db_open(mem_ctx, lock_path("serverid.tdb"),
     43                         0, TDB_DEFAULT|TDB_CLEAR_IF_FIRST|TDB_INCOMPATIBLE_HASH,
     44                         readonly ? O_RDONLY : O_RDWR | O_CREAT,
     45                         0644);
     46        return db_ptr;
     47}
     48
    3749bool serverid_parent_init(TALLOC_CTX *mem_ctx)
    3850{
    39         struct tdb_wrap *db;
    40 
    4151        /*
    4252         * Open the tdb in the parent process (smbd) so that our
     
    4555         */
    4656
    47         db = tdb_wrap_open(mem_ctx, lock_path("serverid.tdb"),
    48                            0, TDB_DEFAULT|TDB_CLEAR_IF_FIRST|TDB_INCOMPATIBLE_HASH, O_RDWR|O_CREAT,
    49                            0644);
    50         if (db == NULL) {
     57        if (serverid_init(mem_ctx, false) == NULL) {
    5158                DEBUG(1, ("could not open serverid.tdb: %s\n",
    5259                          strerror(errno)));
    5360                return false;
    5461        }
     62
    5563        return true;
    5664}
    5765
     66bool serverid_init_readonly(TALLOC_CTX *mem_ctx)
     67{
     68        if (serverid_init(mem_ctx, true) == NULL) {
     69                DEBUG(1, ("could not open serverid.tdb: %s\n",
     70                          strerror(errno)));
     71                return false;
     72        }
     73
     74        return true;
     75}
     76
    5877static struct db_context *serverid_db(void)
    5978{
    60         static struct db_context *db;
    61 
    62         if (db != NULL) {
    63                 return db;
    64         }
    65         db = db_open(NULL, lock_path("serverid.tdb"), 0,
    66                      TDB_DEFAULT|TDB_CLEAR_IF_FIRST|TDB_INCOMPATIBLE_HASH, O_RDWR|O_CREAT, 0644);
    67         return db;
     79        if (db_ptr != NULL) {
     80                return db_ptr;
     81        }
     82
     83        return serverid_init(NULL, false);
    6884}
    6985
Note: See TracChangeset for help on using the changeset viewer.