Changeset 456 for trunk


Ignore:
Timestamp:
Jun 7, 2010, 9:08:40 AM (16 years ago)
Author:
Silvan Scherrer
Message:

Samba Server 3.5: changes from 3.3

Location:
trunk/server
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • trunk/server/lib/replace/getifaddrs.c

    r414 r456  
    262262        struct ifaddrs *curif;
    263263        struct ifaddrs *lastif = NULL;
     264
     265
     266
    264267
    265268        *ifap = NULL;
     
    288291
    289292                if (ioctl(fd, SIOCGIFADDR, ifr) != 0) {
     293
    290294                        freeaddrinfo(*ifap);
    291295                        return -1;
     296
     297
     298
    292299                }
    293300
     
    307314
    308315                if (ioctl(fd, SIOCGIFFLAGS, ifr) != 0) {
     316
    309317                        freeaddrinfo(*ifap);
    310318                        return -1;
     319
     320
     321
    311322                }
    312323
     
    314325
    315326                if (ioctl(fd, SIOCGIFNETMASK, ifr) != 0) {
     327
    316328                        freeaddrinfo(*ifap);
    317329                        return -1;
     330
     331
     332
    318333                }
    319334
     
    321336
    322337                lastif = curif;
     338
    323339
    324340        next:
     
    339355
    340356        close(fd);
     357
    341358        return 0;
     359
     360
     361
     362
     363
     364
    342365}
    343366
  • trunk/server/lib/replace/system/network.h

    r414 r456  
    297297#endif
    298298
     299
    299300#ifndef HAVE_SA_FAMILY_T
    300301#define HAVE_SA_FAMILY_T
    301302typedef unsigned short int sa_family_t;
     303
    302304#endif
    303305
  • trunk/server/lib/replace/system/passwd.h

    r414 r456  
    6868#endif
    6969
    70 #ifdef REPLACE_GETPASS
     70#if
    7171#if defined(REPLACE_GETPASS_BY_GETPASSPHRASE)
    7272#define getpass(prompt) getpassphrase(prompt)
  • trunk/server/lib/tdb/common/io.c

    r414 r456  
    9090                return -1;
    9191
     92
     93
     94
     95
     96
     97
     98
     99
     100
     101
     102
    92103        if (tdb->map_ptr) {
    93104                memcpy(off + (char *)tdb->map_ptr, buf, len);
     
    115126                                 "write %d bytes at %d in two attempts\n",
    116127                                 len, off));
    117                         return -1;
    118                 }
    119         }
     128
     129#ifdef __OS2__ // remove our lock
     130                        tdb_brlock( tdb, off, F_UNLCK, F_SETLK, 0, len);
     131#endif
     132                        return -1;
     133                }
     134        }
     135
     136#ifdef __OS2__ // remove our lock
     137        tdb_brlock( tdb, off, F_UNLCK, F_SETLK, 0, len);
     138#endif
     139
    120140        return 0;
    121141}
  • trunk/server/lib/tdb/common/lock.c

    r414 r456  
    3030#define TDB_MARK_LOCK 0x80000000
    3131
     32
     33
     34
     35
     36
     37
     38
     39
     40
     41
     42
     43
     44
     45
     46
     47
     48
     49
     50
     51
     52
     53
     54
     55
     56
     57
     58
     59
     60
     61
     62
     63
     64
     65
     66
     67
     68
     69
     70
     71
     72
     73
     74
     75
     76
     77
     78
     79
     80
     81
     82
     83
     84
     85
     86
     87
     88
     89
     90
     91
     92
     93
     94
     95
     96
     97
     98
     99
     100
     101
     102
     103
     104
     105
     106
     107
     108
     109
     110
     111
     112
     113
     114
     115
     116
     117
     118
     119
    32120void tdb_setalarm_sigptr(struct tdb_context *tdb, volatile sig_atomic_t *ptr)
    33121{
     
    46134               int rw_type, int lck_type, int probe, size_t len)
    47135{
     136
     137
     138
     139
     140
     141
     142
     143
     144
     145
     146
     147
     148
     149
     150
     151
     152
     153
     154
     155
     156
     157
     158
     159
     160
     161
     162
     163
     164
     165
     166
     167
     168
     169
     170
     171
     172
     173
     174
     175
     176
     177
     178
     179
     180
     181
     182
     183
     184
     185
     186
     187
     188
     189
     190
     191
     192
     193
     194
     195
     196
     197
     198
     199
     200
     201
     202
     203
     204
     205
     206
     207
     208
     209
     210
     211
     212
     213
     214
     215
     216
     217
     218
     219
     220
     221
     222
    48223        struct flock fl;
    49224        int ret;
     
    87262        }
    88263        return 0;
     264
    89265}
    90266
     
    101277        while (count--) {
    102278                struct timeval tv;
     279
     280
     281
     282
     283
     284
    103285                if (tdb_brlock(tdb, offset, F_WRLCK, F_SETLKW, 1, len) == 0) {
    104286                        return 0;
  • trunk/server/lib/tdb/common/open.c

    r414 r456  
    2727
    2828#include "tdb_private.h"
     29
     30
     31
     32
     33
    2934
    3035/* all contexts, to ensure no double-opens (fcntl locks don't nest!) */
     
    179184        tdb->hash_fn = hash_fn ? hash_fn : default_tdb_hash;
    180185
     186
     187
     188
     189
     190
     191
    181192        /* cache the page size */
    182193        tdb->page_size = getpagesize();
     
    250261        /* we need to zero database if we are the only one with it open */
    251262        if ((tdb_flags & TDB_CLEAR_IF_FIRST) &&
    252             (!tdb->read_only) &&
    253             (locked = (tdb->methods->tdb_brlock(tdb, ACTIVE_LOCK, F_WRLCK, F_SETLK, 0, 1) == 0))) {
     263            (!tdb->read_only)
     264#ifndef __OS2__
     265            && (locked = (tdb->methods->tdb_brlock(tdb, ACTIVE_LOCK, F_WRLCK, F_SETLK, 0, 1) == 0))
     266#endif
     267            ) {
    254268                open_flags |= O_CREAT;
    255269                if (ftruncate(tdb->fd, 0) == -1) {
     
    314328        tdb_mmap(tdb);
    315329        if (locked) {
     330
    316331                if (tdb->methods->tdb_brlock(tdb, ACTIVE_LOCK, F_UNLCK, F_SETLK, 0, 1) == -1) {
    317332                        TDB_LOG((tdb, TDB_DEBUG_ERROR, "tdb_open_ex: "
     
    321336                }
    322337
     338
    323339        }
    324340
     
    327343           users know we're using it. */
    328344
     345
    329346        if (tdb_flags & TDB_CLEAR_IF_FIRST) {
    330347                /* leave this lock in place to indicate it's in use */
     
    332349                        goto fail;
    333350        }
     351
    334352
    335353        /* if needed, run recovery */
     
    337355                goto fail;
    338356        }
     357
     358
     359
     360
     361
     362
    339363
    340364#ifdef TDB_TRACE
     
    358382         * do with disk files, and resume here by releasing their
    359383         * global lock and hooking into the active list. */
     384
    360385        if (tdb->methods->tdb_brlock(tdb, GLOBAL_LOCK, F_UNLCK, F_SETLKW, 0, 1) == -1)
    361386                goto fail;
     387
    362388        tdb->next = tdbs;
    363         tdbs = tdb;
     389        tdbs = tdb;
    364390        return tdb;
    365391
     
    380406        }
    381407        SAFE_FREE(tdb->name);
     408
     409
     410
     411
     412
     413
     414
     415
    382416        if (tdb->fd != -1)
    383417                if (close(tdb->fd) != 0)
     
    420454        }
    421455        SAFE_FREE(tdb->name);
     456
     457
     458
     459
     460
    422461        if (tdb->fd != -1) {
    423462                ret = close(tdb->fd);
     
    425464        }
    426465        SAFE_FREE(tdb->lockrecs);
     466
     467
     468
     469
     470
     471
     472
     473
    427474
    428475        /* Remove from contexts list */
     
    465512                return 0; /* Nothing to do. */
    466513        }
     514
     515
     516
     517
     518
     519
     520
     521
     522
     523
     524
     525
     526
    467527
    468528        if (tdb->num_locks != 0 || tdb->global_lock.count) {
     
    551611        return 0;
    552612}
     613
     614
     615
     616
     617
     618
     619
     620
     621
     622
     623
     624
     625
     626
     627
     628
     629
     630
     631
     632
     633
     634
     635
     636
     637
     638
     639
     640
     641
     642
     643
     644
     645
     646
     647
     648
     649
     650
     651
     652
     653
     654
     655
     656
     657
     658
     659
     660
     661
  • trunk/server/lib/tdb/common/tdb_private.h

    r414 r456  
    2323   License along with this library; if not, see <http://www.gnu.org/licenses/>.
    2424*/
     25
     26
     27
     28
     29
     30
    2531
    2632#include "replace.h"
     
    204210#endif
    205211        volatile sig_atomic_t *interrupt_sig_ptr;
     212
     213
     214
     215
     216
    206217};
    207218
  • trunk/server/lib/tdb/common/transaction.c

    r414 r456  
    495495        /* get a read lock from the freelist to the end of file. This
    496496           is upgraded to a write lock during the commit */
     497
    497498        if (tdb_brlock(tdb, FREELIST_TOP, F_RDLCK, F_SETLKW, 0, 0) == -1) {
    498499                TDB_LOG((tdb, TDB_DEBUG_ERROR, "tdb_transaction_start: failed to get hash locks\n"));
     
    500501                goto fail;
    501502        }
     503
    502504
    503505        /* setup a copy of the hash table heads so the hash scan in
     
    531533       
    532534fail:
     535
    533536        tdb_brlock(tdb, FREELIST_TOP, F_UNLCK, F_SETLKW, 0, 0);
     537
    534538        tdb_transaction_unlock(tdb);
    535539        SAFE_FREE(tdb->transaction->blocks);
     
    632636        tdb->methods = tdb->transaction->io_methods;
    633637
     638
    634639        tdb_brlock(tdb, FREELIST_TOP, F_UNLCK, F_SETLKW, 0, 0);
     640
    635641        tdb_transaction_unlock(tdb);
    636642        SAFE_FREE(tdb->transaction->hash_heads);
     
    940946
    941947        /* upgrade the main transaction lock region to a write lock */
     948
    942949        if (tdb_brlock_upgrade(tdb, FREELIST_TOP, 0) == -1) {
    943950                TDB_LOG((tdb, TDB_DEBUG_ERROR, "tdb_transaction_prepare_commit: failed to upgrade hash locks\n"));
     
    946953                return -1;
    947954        }
     955
    948956
    949957        /* get the global lock - this prevents new users attaching to the database
  • trunk/server/lib/tdb/tools/tdbtool.c

    r414 r456  
    3737char cmdline[1024];
    3838static int disable_mmap;
     39
     40
     41
     42
    3943
    4044enum commands {
     
    239243        tdb = tdb_open_ex(tdbname, 0, disable_mmap?TDB_NOMMAP:0, O_RDWR, 0600,
    240244                          &log_ctx, NULL);
     245
     246
     247
    241248        if (!tdb) {
     249
    242250                printf("Could not open %s: %s\n", tdbname, strerror(errno));
    243251        }
     
    563571        int cmd_len;
    564572
     573
     574
     575
     576
    565577        if (cmdname && strlen(cmdname) == 0) {
    566578                mycmd = CMD_NEXT;
     
    575587                }
    576588        }
     589
     590
     591
    577592
    578593        switch (mycmd) {
     
    730745        arg2 = NULL;
    731746        arg2len = 0;
     747
     748
     749
     750
     751
     752
     753
     754
     755
     756
     757
     758
    732759
    733760        if (argv[1]) {
     
    770797                cmdname = argv[2];
    771798        default:
     799
     800
     801
     802
     803
    772804                do_command();
    773805                break;
  • trunk/server/lib/util/become_daemon.c

    r414 r456  
    6969_PUBLIC_ void become_daemon(bool do_fork, bool no_process_group)
    7070{
     71
     72
     73
     74
    7175        if (do_fork) {
    7276                if (sys_fork()) {
  • trunk/server/lib/util/blocking.c

    r414 r456  
    5454        if((val = fcntl(fd, F_GETFL, 0)) == -1)
    5555                return -1;
     56
    5657        if(set) /* Turn blocking on - ie. clear nonblock flag */
    5758                val &= ~FLAG_TO_SET;
     
    5960                val |= FLAG_TO_SET;
    6061        return fcntl( fd, F_SETFL, val);
     62
     63
     64
     65
     66
     67
     68
     69
    6170#undef FLAG_TO_SET
    6271}
  • trunk/server/lib/util/genrand.c

    r414 r456  
    224224        unsigned char *p;
    225225
     226
    226227        if(!done_reseed) {
    227228                bytes_since_reseed += len;
     
    242243                done_reseed = true;
    243244        }
     245
    244246
    245247        /*
     
    254256                int copy_len = len > 16 ? 16 : len;
    255257
     258
     259
     260
    256261                get_random_stream(md4_buf, sizeof(md4_buf));
     262
    257263                mdfour(tmp_buf, md4_buf, sizeof(md4_buf));
    258264                memcpy(p, tmp_buf, copy_len);
  • trunk/server/lib/util/util.c

    r414 r456  
    223223        lock.l_pid = 0;
    224224
     225
    225226        ret = fcntl(fd,op,&lock);
    226227
  • trunk/server/libcli/util/ntstatus.h

    r414 r456  
    3030*/
    3131
    32 #if defined(HAVE_IMMEDIATE_STRUCTURES)
     32#if defined(HAVE_IMMEDIATE_STRUCTURES)
    3333typedef struct {uint32_t v;} NTSTATUS;
    3434#define NT_STATUS(x) ((NTSTATUS) { x })
  • trunk/server/libcli/util/werror.h

    r414 r456  
    3030*/
    3131
    32 #if defined(HAVE_IMMEDIATE_STRUCTURES)
     32#if defined(HAVE_IMMEDIATE_STRUCTURES)
    3333typedef struct {uint32_t v;} WERROR;
    3434#define W_ERROR(x) ((WERROR) { x })
  • trunk/server/source3/build.cmd

    r454 r456  
    8585if conf = "YES" then do
    8686        address cmd 'SETLOCAL'
     87
    8788        address cmd 'SET CFLAGS=-g -Zomf -O1 -march=pentium -mtune=pentium4'
    8889        address cmd 'SET CXXFLAGS=-g -Zomf -O1 -march=pentium -mtune=pentium4'
     
    9091        address cmd 'SET AR=emxomfar'
    9192        address cmd 'SET LIBS=-lsocket -lsyslog'
     93
    9294    /* disabled options:
    9395         --enable-developer --enable-socket-wrapper
Note: See TracChangeset for help on using the changeset viewer.