Changeset 149 for trunk/samba/source/lib


Ignore:
Timestamp:
Aug 20, 2008, 9:10:33 AM (17 years ago)
Author:
Paul Smedley
Message:

Update trunk to v3.2.2

Location:
trunk/samba/source/lib
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/samba/source/lib/charcnv.c

    r136 r149  
    4848static smb_iconv_t conv_handles[NUM_CHARSETS][NUM_CHARSETS];
    4949static bool conv_silent; /* Should we do a debug if the conversion fails ? */
     50static bool initialized;
    5051
    5152/**
     
    9394void lazy_initialize_conv(void)
    9495{
    95         static int initialized = False;
    96 
    9796        if (!initialized) {
    98                 initialized = True;
    9997                load_case_tables();
    10098                init_iconv();
     99                initialized = true;
    101100        }
    102101}
     
    117116                }
    118117        }
     118        initialized = false;
    119119}
    120120
  • trunk/samba/source/lib/dbwrap_ctdb.c

    r133 r149  
    489489        tdb_flags &= TDB_SEQNUM;
    490490
     491        /* honor permissions if user has specified O_CREAT */
     492        if (open_flags & O_CREAT) {
     493                chmod(db_path, mode);
     494        }
     495
    491496        db_ctdb->wtdb = tdb_wrap_open(db_ctdb, db_path, hash_size, tdb_flags, O_RDWR, 0);
    492497        if (db_ctdb->wtdb == NULL) {
  • trunk/samba/source/lib/dbwrap_util.c

    r133 r149  
    9999}
    100100
     101/**
     102 * Atomic unsigned integer change (addition):
     103 *
     104 * if value does not exist yet in the db, use *oldval as initial old value.
     105 * return old value in *oldval.
     106 * store *oldval + change_val to db.
     107 */
    101108uint32_t dbwrap_change_uint32_atomic(struct db_context *db, const char *keystr,
    102109                                     uint32_t *oldval, uint32_t change_val)
     
    111118        }
    112119
    113         if ((rec->value.dptr != NULL)
    114             && (rec->value.dsize == sizeof(val))) {
     120        if (rec->value.dptr == NULL) {
     121                val = *oldval;
     122        } else if (rec->value.dsize == sizeof(val)) {
    115123                val = IVAL(rec->value.dptr, 0);
     124                *oldval = val;
     125        } else {
     126                return -1;
    116127        }
    117128
     
    128139}
    129140
     141/**
     142 * Atomic integer change (addition):
     143 *
     144 * if value does not exist yet in the db, use *oldval as initial old value.
     145 * return old value in *oldval.
     146 * store *oldval + change_val to db.
     147 */
    130148int32 dbwrap_change_int32_atomic(struct db_context *db, const char *keystr,
    131149                                 int32 *oldval, int32 change_val)
     
    140158        }
    141159
    142         if ((rec->value.dptr != NULL)
    143             && (rec->value.dsize == sizeof(val))) {
     160        if (rec->value.dptr == NULL) {
     161                val = *oldval;
     162        } else if (rec->value.dsize == sizeof(val)) {
    144163                val = IVAL(rec->value.dptr, 0);
     164                *oldval = val;
     165        } else {
     166                return -1;
    145167        }
    146168
  • trunk/samba/source/lib/debug.c

    r141 r149  
    9595/*
    9696 * This is to allow assignment to DEBUGLEVEL before the debug
    97  * system has been initialised.
     97 * system has been initialized.
    9898 */
    9999static int debug_all_class_hack = 1;
     
    184184****************************************************************************/
    185185
     186static bool initialized;
     187
    186188void gfree_debugsyms(void)
    187189{
     
    195197        }
    196198
    197         if ( DEBUGLEVEL_CLASS != &debug_all_class_hack )
     199        if ( DEBUGLEVEL_CLASS != &debug_all_class_hack ) {
    198200                SAFE_FREE( DEBUGLEVEL_CLASS );
    199 
    200         if ( DEBUGLEVEL_CLASS_ISSET != &debug_all_class_isset_hack )
     201                DEBUGLEVEL_CLASS = &debug_all_class_hack;
     202        }
     203
     204        if ( DEBUGLEVEL_CLASS_ISSET != &debug_all_class_isset_hack ) {
    201205                SAFE_FREE( DEBUGLEVEL_CLASS_ISSET );
     206                DEBUGLEVEL_CLASS_ISSET = &debug_all_class_isset_hack;
     207        }
    202208
    203209        SAFE_FREE(format_bufr);
     210
     211        debug_num_classes = 0;
     212
     213        debug_level = DEBUGLEVEL_CLASS;
     214
     215        initialized = false;
    204216}
    205217
     
    531543void debug_init(void)
    532544{
    533         static bool initialised = False;
    534545        const char **p;
    535546
    536         if (initialised)
     547        if (initialized)
    537548                return;
    538549
    539         initialised = True;
     550        initialized = true;
    540551
    541552        for(p = default_classname_table; *p; p++) {
  • trunk/samba/source/lib/errmap_unix.c

    r133 r149  
    108108        int i = 0;
    109109
    110         if (unix_error == 0)
    111                 return NT_STATUS_OK;
     110        if (unix_error == 0) {
     111                /* we map this to an error, not success, as this
     112                   function is only called in an error path. Lots of
     113                   our virtualised functions may fail without making a
     114                   unix system call that fails (such as when they are
     115                   checking for some handle existing), so unix_error
     116                   may be unset
     117                */
     118                return NT_STATUS_UNSUCCESSFUL;
     119        }
    112120
    113121        /* Look through list */
  • trunk/samba/source/lib/netapi/netapi.h

    r133 r149  
    2020#ifndef __LIB_NETAPI_H__
    2121#define __LIB_NETAPI_H__
     22
     23#ifdef __cplusplus
     24extern "C" {
     25#endif /* __cplusplus */
    2226
    2327/****************************************************************
     
    460464                                          void **buffer /* [out] [noprint,ref] */);
    461465
    462 #endif
     466#ifdef __cplusplus
     467}
     468#endif /* __cplusplus */
     469
     470#endif /* __LIB_NETAPI_H__ */
  • trunk/samba/source/lib/replace/libreplace_cc.m4

    r138 r149  
    168168                } f2[] = {
    169169                        {FOO_ONE}
    170                 };   
     170                };
     171                static const FOOBAR f3[] = {FOO_ONE};
    171172        ],
    172173        libreplace_cv_immediate_structures=yes,
  • trunk/samba/source/lib/replace/replace.c

    r141 r149  
    171171
    172172        gid_t *grouplst = NULL;
    173         int max_gr = 32;
     173        int max_gr = NGROUPS_MAX;
    174174        int ret;
    175175        int    i,j;
  • trunk/samba/source/lib/tdb/common/tdb.c

    r133 r149  
    244244        if (tdb->read_only || tdb->traverse_read) return -1;
    245245
    246         if (tdb->traverse_write != 0 ||
     246        if (((tdb->traverse_write != 0) && (!TDB_DEAD(rec))) ||
    247247            tdb_write_lock_record(tdb, rec_ptr) == -1) {
    248248                /* Someone traversing here: mark it as dead */
  • trunk/samba/source/lib/util.c

    r136 r149  
    192192        gfree_loadparm();
    193193        gfree_case_tables();
    194         gfree_debugsyms();
    195194        gfree_charcnv();
    196195        gfree_interfaces();
    197 
    198         /* release the talloc null_context memory last */
    199         talloc_disable_null_tracking();
     196        gfree_debugsyms();
    200197}
    201198
     
    596593
    597594        ret = S_ISDIR(st->st_mode);
    598         if(!ret)
    599                 errno = ENOTDIR;
     595        if(!ret){
     596                DEBUG( 0, ( "PS - ENOTDIR1\n" ) );
     597                errno = ENOTDIR;}
    600598        return ret;
    601599}
  • trunk/samba/source/lib/util_sid.c

    r133 r149  
    679679
    680680        if (include_user_group_rid) {
    681 
    682                 if (!sid_compose(&sid, info3->base.domain_sid, info3->base.rid))
    683                 {
     681                if (!sid_compose(&sid, info3->base.domain_sid, info3->base.rid)) {
    684682                        DEBUG(3, ("could not compose user SID from rid 0x%x\n",
    685683                                  info3->base.rid));
     
    692690                        return status;
    693691                }
    694 
    695                 if (!sid_compose(&sid, info3->base.domain_sid, info3->base.primary_gid))
    696                 {
    697                         DEBUG(3, ("could not compose group SID from rid 0x%x\n",
    698                                   info3->base.primary_gid));
    699                         return NT_STATUS_INVALID_PARAMETER;
     692        }
     693
     694        if (!sid_compose(&sid, info3->base.domain_sid, info3->base.primary_gid)) {
     695                DEBUG(3, ("could not compose group SID from rid 0x%x\n",
     696                          info3->base.primary_gid));
     697                return NT_STATUS_INVALID_PARAMETER;
     698        }
     699        status = add_sid_to_array(mem_ctx, &sid, &sid_array, &num_sids);
     700        if (!NT_STATUS_IS_OK(status)) {
     701                DEBUG(3, ("could not append group SID from rid 0x%x\n",
     702                          info3->base.rid));
     703                return status;
     704        }
     705
     706        for (i = 0; i < info3->base.groups.count; i++) {
     707                /* Don't add the primary group sid twice. */
     708                if (info3->base.primary_gid == info3->base.groups.rids[i].rid) {
     709                        continue;
    700710                }
    701                 status = add_sid_to_array(mem_ctx, &sid, &sid_array, &num_sids);
    702                 if (!NT_STATUS_IS_OK(status)) {
    703                         DEBUG(3, ("could not append group SID from rid 0x%x\n",
    704                                   info3->base.rid));
    705                         return status;
    706                 }
    707         }
    708 
    709         for (i = 0; i < info3->base.groups.count; i++) {
    710711                if (!sid_compose(&sid, info3->base.domain_sid,
    711                                  info3->base.groups.rids[i].rid))
    712                 {
     712                                 info3->base.groups.rids[i].rid)) {
    713713                        DEBUG(3, ("could not compose SID from additional group "
    714714                                  "rid 0x%x\n", info3->base.groups.rids[i].rid));
  • trunk/samba/source/lib/util_unistr.c

    r133 r149  
    3434static bool lowcase_table_use_unmap;
    3535static bool valid_table_use_unmap;
     36static bool initialized;
    3637
    3738/**
     
    6061                        SAFE_FREE(valid_table);
    6162        }
     63        initialized = false;
    6264}
    6365
     
    7173void load_case_tables(void)
    7274{
    73         static int initialised;
    7475        char *old_locale = NULL, *saved_locale = NULL;
    7576        int i;
    7677        TALLOC_CTX *frame = NULL;
    7778
    78         if (initialised) {
     79        if (initialized) {
    7980                return;
    8081        }
    81         initialised = 1;
     82        initialized = true;
    8283
    8384        frame = talloc_stackframe();
Note: See TracChangeset for help on using the changeset viewer.