Changeset 746 for vendor/current/lib


Ignore:
Timestamp:
Nov 27, 2012, 4:56:06 PM (13 years ago)
Author:
Silvan Scherrer
Message:

Samba Server: updated vendor to 3.6.9

Location:
vendor/current/lib
Files:
22 edited

Legend:

Unmodified
Added
Removed
  • vendor/current/lib/addns/dnsmarshall.c

    r740 r746  
    2828        struct dns_buffer *result;
    2929
    30         if (!(result = talloc(mem_ctx, struct dns_buffer))) {
     30        if (!(result = talloc_zero(mem_ctx, struct dns_buffer))) {
    3131                return NULL;
    3232        }
     
    4040        result->size = 2;
    4141
    42         if (!(result->data = TALLOC_ARRAY(result, uint8, result->size))) {
     42        if (!(result->data = TALLOC_ZERO_ARRAY(result, uint8, result->size))) {
    4343                TALLOC_FREE(result);
    4444                return NULL;
     
    217217        }
    218218
    219         if (!(label = talloc(mem_ctx, struct dns_domain_label))) {
     219        if (!(label = talloc_zero(mem_ctx, struct dns_domain_label))) {
    220220                buf->error = ERROR_DNS_NO_MEMORY;
    221221                return;
     
    224224        label->len = len;
    225225
    226         if (!(label->label = TALLOC_ARRAY(label, char, len+1))) {
     226        if (!(label->label = TALLOC_ZERO_ARRAY(label, char, len+1))) {
    227227                buf->error = ERROR_DNS_NO_MEMORY;
    228228                goto error;
     
    251251        if (!ERR_DNS_IS_OK(buf->error)) return;
    252252
    253         if (!(name = talloc(mem_ctx, struct dns_domain_name))) {
     253        if (!(name = talloc_zero(mem_ctx, struct dns_domain_name))) {
    254254                buf->error = ERROR_DNS_NO_MEMORY;
    255255                return;
     
    282282        if (!(ERR_DNS_IS_OK(buf->error))) return;
    283283
    284         if (!(q = talloc(mem_ctx, struct dns_question))) {
     284        if (!(q = talloc_zero(mem_ctx, struct dns_question))) {
    285285                buf->error = ERROR_DNS_NO_MEMORY;
    286286                return;
     
    315315        if (!(ERR_DNS_IS_OK(buf->error))) return;
    316316
    317         if (!(r = talloc(mem_ctx, struct dns_rrec))) {
     317        if (!(r = talloc_zero(mem_ctx, struct dns_rrec))) {
    318318                buf->error = ERROR_DNS_NO_MEMORY;
    319319                return;
     
    330330
    331331        if (r->data_length != 0) {
    332                 if (!(r->data = TALLOC_ARRAY(r, uint8, r->data_length))) {
     332                if (!(r->data = TALLOC_ZERO_ARRAY(r, uint8, r->data_length))) {
    333333                        buf->error = ERROR_DNS_NO_MEMORY;
    334334                        return;
     
    407407
    408408        if ((req->num_questions != 0) &&
    409             !(req->questions = TALLOC_ARRAY(req, struct dns_question *,
     409            !(req->questions = TALLOC_ZERO_ARRAY(req, struct dns_question *,
    410410                                            req->num_questions))) {
    411411                goto error;
    412412        }
    413413        if ((req->num_answers != 0) &&
    414             !(req->answers = TALLOC_ARRAY(req, struct dns_rrec *,
     414            !(req->answers = TALLOC_ZERO_ARRAY(req, struct dns_rrec *,
    415415                                          req->num_answers))) {
    416416                goto error;
    417417        }
    418418        if ((req->num_auths != 0) &&
    419             !(req->auths = TALLOC_ARRAY(req, struct dns_rrec *,
     419            !(req->auths = TALLOC_ZERO_ARRAY(req, struct dns_rrec *,
    420420                                        req->num_auths))) {
    421421                goto error;
    422422        }
    423423        if ((req->num_additionals != 0) &&
    424             !(req->additionals = TALLOC_ARRAY(req, struct dns_rrec *,
     424            !(req->additionals = TALLOC_ZERO_ARRAY(req, struct dns_rrec *,
    425425                                              req->num_additionals))) {
    426426                goto error;
  • vendor/current/lib/addns/dnsrecord.c

    r740 r746  
    2828                            struct dns_request **preq )
    2929{
    30         struct dns_request *req;
    31         struct dns_question *q;
     30        struct dns_request *req = NULL;
     31        struct dns_question *q = NULL;
    3232        DNS_ERROR err;
    3333
     
    6161                             struct dns_update_request **preq )
    6262{
    63         struct dns_update_request *req;
    64         struct dns_zone *z;
     63        struct dns_update_request *req = NULL;
     64        struct dns_zone *z = NULL;
    6565        DNS_ERROR err;
    6666
     
    9696                          struct dns_rrec **prec)
    9797{
    98         struct dns_rrec *rec;
     98        struct dns_rrec *rec = NULL;
    9999        DNS_ERROR err;
    100100
     
    182182                                 struct dns_rrec **prec)
    183183{
    184         struct dns_buffer *buf;
    185         struct dns_domain_name *algorithm;
     184        struct dns_buffer *buf = NULL;
     185        struct dns_domain_name *algorithm = NULL;
    186186        DNS_ERROR err;
    187187
     
    218218                                     struct dns_tkey_record **ptkey)
    219219{
    220         struct dns_tkey_record *tkey;
     220        struct dns_tkey_record *tkey = NULL;
    221221        struct dns_buffer buf;
    222222        uint32 tmp_inception, tmp_expiration;
     
    270270                                 struct dns_rrec **prec)
    271271{
    272         struct dns_buffer *buf;
    273         struct dns_domain_name *algorithm;
     272        struct dns_buffer *buf = NULL;
     273        struct dns_domain_name *algorithm = NULL;
    274274        DNS_ERROR err;
    275275
     
    332332                           struct dns_update_request **preq)
    333333{
    334         struct dns_update_request *req;
    335         struct dns_rrec *rec;
     334        struct dns_update_request *req = NULL;
     335        struct dns_rrec *rec = NULL;
    336336        DNS_ERROR err;
    337337        uint16 i;
     
    370370                                    struct dns_update_request **preq)
    371371{
    372         struct dns_update_request *req;
    373         struct dns_rrec *rec;
     372        struct dns_update_request *req = NULL;
     373        struct dns_rrec *rec = NULL;
    374374        DNS_ERROR err;
    375375        size_t i;
  • vendor/current/lib/async_req/async_sock.c

    r740 r746  
    326326        struct async_connect_state *state =
    327327                tevent_req_data(req, struct async_connect_state);
    328 
    329         /*
    330          * Stevens, Network Programming says that if there's a
    331          * successful connect, the socket is only writable. Upon an
    332          * error, it's both readable and writable.
    333          */
    334         if ((flags & (TEVENT_FD_READ|TEVENT_FD_WRITE))
    335             == (TEVENT_FD_READ|TEVENT_FD_WRITE)) {
    336                 int ret;
    337 
    338                 ret = connect(state->fd,
    339                               (struct sockaddr *)(void *)&state->address,
    340                               state->address_len);
    341                 if (ret == 0) {
    342                         TALLOC_FREE(fde);
    343                         tevent_req_done(req);
    344                         return;
    345                 }
    346 
    347                 if (errno == EINPROGRESS) {
    348                         /* Try again later, leave the fde around */
    349                         return;
    350                 }
     328        int ret;
     329
     330        ret = connect(state->fd, (struct sockaddr *)(void *)&state->address,
     331                      state->address_len);
     332        if (ret == 0) {
     333                state->sys_errno = 0;
    351334                TALLOC_FREE(fde);
    352                 tevent_req_error(req, errno);
    353                 return;
    354         }
    355 
    356         state->sys_errno = 0;
    357         tevent_req_done(req);
     335                tevent_req_done(req);
     336                return;
     337        }
     338        if (errno == EINPROGRESS) {
     339                /* Try again later, leave the fde around */
     340                return;
     341        }
     342        state->sys_errno = errno;
     343        TALLOC_FREE(fde);
     344        tevent_req_error(req, errno);
     345        return;
    358346}
    359347
  • vendor/current/lib/crypto/hmacmd5.c

    r740 r746  
    3737        if (key_len > 64)
    3838        {
    39                 struct MD5Context tctx;
     39                MD5_CTX tctx;
    4040
    4141                MD5Init(&tctx);
     
    9292_PUBLIC_ void hmac_md5_final(uint8_t *digest, HMACMD5Context *ctx)
    9393{
    94         struct MD5Context ctx_o;
     94        MD5_CTX ctx_o;
    9595
    9696        MD5Final(digest, &ctx->ctx);         
  • vendor/current/lib/crypto/hmacmd5.h

    r414 r746  
    2626typedef struct
    2727{
    28         struct MD5Context ctx;
     28        MD5_CTX ctx;
    2929        uint8_t k_ipad[65];   
    3030        uint8_t k_opad[65];
  • vendor/current/lib/crypto/md5.h

    r414 r746  
    66#endif
    77
     8#ifdef HAVE_MD5_H
     9/*
     10 * Try to avoid clashes with Solaris MD5 implementation.
     11 * ...where almost all implementations follows:
     12 * "Schneier's Cryptography Classics Library"
     13 */
     14#include <md5.h>
     15#else
     16
    817struct MD5Context {
    918        uint32_t buf[4];
     
    1120        uint8_t in[64];
    1221};
     22typedef struct MD5Context MD5_CTX;
    1323
    1424void MD5Init(struct MD5Context *context);
     
    1727void MD5Final(uint8_t digest[16], struct MD5Context *context);
    1828
     29#endif /* !HAVE_MD5_H */
     30
    1931#endif /* !MD5_H */
  • vendor/current/lib/crypto/md5test.c

    r740 r746  
    6464
    6565        for (i=0; i < ARRAY_SIZE(testarray); i++) {
    66                 struct MD5Context ctx;
     66                MD5_CTX ctx;
    6767                uint8_t md5[16];
    6868                int e;
  • vendor/current/lib/popt/system.h

    r414 r746  
    5959#elif defined(__GNUC__) && defined(__STRICT_ANSI__)
    6060#define alloca __builtin_alloca
     61#elif defined(__GNUC__) && defined(HAVE_ALLOCA_H)
     62# include <alloca.h>
    6163#endif
    6264
  • vendor/current/lib/replace/poll.c

    r740 r746  
    3131#include "replace.h"
    3232#include "system/select.h"
     33#ifdef HAVE_SYS_TIME_H
     34#include <sys/time.h>
     35#endif
     36#ifdef HAVE_SYS_IOCTL_H
     37#include <sys/ioctl.h>
     38#endif
    3339
    3440
     
    4147        nfds_t i;
    4248
    43         if (fds == NULL) {
     49        if ((fds == NULL) && (nfds != 0)) {
    4450                errno = EFAULT;
    4551                return -1;
  • vendor/current/lib/replace/replace.h

    r740 r746  
    803803#endif
    804804
     805#if !defined(getpass)
     806#ifdef REPLACE_GETPASS
     807#if defined(REPLACE_GETPASS_BY_GETPASSPHRASE)
     808#define getpass(prompt) getpassphrase(prompt)
     809#else
     810#define getpass(prompt) rep_getpass(prompt)
     811char *rep_getpass(const char *prompt);
     812#endif
     813#endif
     814#endif
     815
    805816#endif /* _LIBREPLACE_REPLACE_H */
  • vendor/current/lib/replace/system/passwd.h

    r740 r746  
    6868#endif
    6969
     70#if !defined(getpass)
    7071#ifdef REPLACE_GETPASS
    7172#if defined(REPLACE_GETPASS_BY_GETPASSPHRASE)
     
    7475#define getpass(prompt) rep_getpass(prompt)
    7576char *rep_getpass(const char *prompt);
     77#endif
    7678#endif
    7779#endif
  • vendor/current/lib/talloc/talloc.3.xml

    r740 r746  
    784784    <para>
    785785      This program is free software; you can redistribute it and/or modify
    786       it under the terms of the GNU General Public License as published by
    787       the Free Software Foundation; either version 3 of the License, or (at
    788       your option) any later version.
     786      it under the terms of the GNU Lesser General Public License as
     787      published by the Free Software Foundation; either version 3 of the
     788      License, or (at your option) any later version.
    789789    </para>
    790790    <para>
  • vendor/current/lib/talloc/talloc.c

    r740 r746  
    839839                if (tc->prev) tc->prev->next = tc->next;
    840840                if (tc->next) tc->next->prev = tc->prev;
     841                tc->prev = tc->next = NULL;
    841842        }
    842843
     
    926927                if (tc->prev) tc->prev->next = tc->next;
    927928                if (tc->next) tc->next->prev = tc->prev;
     929                tc->prev = tc->next = NULL;
    928930        }
    929931
     
    12521254                        if (p) new_parent = TC_PTR_FROM_CHUNK(p);
    12531255                }
    1254                 /* finding the parent here is potentially quite
    1255                    expensive, but the alternative, which is to change
    1256                    talloc to always have a valid tc->parent pointer,
    1257                    makes realloc more expensive where there are a
    1258                    large number of children.
    1259 
    1260                    The reason we need the parent pointer here is that
    1261                    if _talloc_free_internal() fails due to references
    1262                    or a failing destructor we need to re-parent, but
    1263                    the free call can invalidate the prev pointer.
    1264                 */
    1265                 if (new_parent == null_context && (tc->child->refs || tc->child->destructor)) {
    1266                         old_parent = talloc_parent_chunk(ptr);
    1267                 }
    12681256                if (unlikely(_talloc_free_internal(child, location) == -1)) {
    12691257                        if (new_parent == null_context) {
    1270                                 struct talloc_chunk *p = old_parent;
     1258                                struct talloc_chunk *p = talloc_parent_chunk(ptr);
    12711259                                if (p) new_parent = TC_PTR_FROM_CHUNK(p);
    12721260                        }
     
    12831271_PUBLIC_ void talloc_free_children(void *ptr)
    12841272{
     1273        struct talloc_chunk *tc_name = NULL;
    12851274        struct talloc_chunk *tc;
    12861275
     
    12911280        tc = talloc_chunk_from_ptr(ptr);
    12921281
     1282        /* we do not want to free the context name if it is a child .. */
     1283        if (likely(tc->child)) {
     1284                for (tc_name = tc->child; tc_name; tc_name = tc_name->next) {
     1285                        if (tc->name == TC_PTR_FROM_CHUNK(tc_name)) break;
     1286                }
     1287                if (tc_name) {
     1288                        _TLIST_REMOVE(tc->child, tc_name);
     1289                        if (tc->child) {
     1290                                tc->child->parent = tc;
     1291                        }
     1292                }
     1293        }
     1294
    12931295        _talloc_free_children_internal(tc, ptr, __location__);
     1296
     1297        /* .. so we put it back after all other children have been freed */
     1298        if (tc_name) {
     1299                if (tc->child) {
     1300                        tc->child->parent = NULL;
     1301                }
     1302                tc_name->parent = tc;
     1303                _TLIST_ADD(tc->child, tc_name);
     1304        }
    12941305}
    12951306
  • vendor/current/lib/talloc/talloc.h

    r740 r746  
    174174 * no modifications and return -1.
    175175 *
    176  * If this pointer has an additional parent when talloc_free() is called
    177  * then the memory is not actually released, but instead the most
    178  * recently established parent is destroyed. See talloc_reference() for
    179  * details on establishing additional parents.
    180  *
    181  * For more control on which parent is removed, see talloc_unlink()
    182  *
    183  * talloc_free() operates recursively on its children.
    184  *
    185  * From the 2.0 version of talloc, as a special case, talloc_free() is
    186  * refused on pointers that have more than one parent, as talloc would
    187  * have no way of knowing which parent should be removed. To free a
     176 * From version 2.0 and onwards, as a special case, talloc_free() is
     177 * refused on pointers that have more than one parent associated, as talloc
     178 * would have no way of knowing which parent should be removed. This is
     179 * different from older versions in the sense that always the reference to
     180 * the most recently established parent has been destroyed. Hence to free a
    188181 * pointer that has more than one parent please use talloc_unlink().
    189182 *
     
    201194 * talloc_set_log_stderr() for more information on talloc logging
    202195 * functions.
     196 *
     197 * talloc_free() operates recursively on its children.
    203198 *
    204199 * @param[in]  ptr      The chunk to be freed.
     
    234229 * talloc_free()s only the children, not the context itself.
    235230 *
    236  * @param[in]  ptr      The chunk that you want to free the children of.
     231 * A NULL argument is handled as no-op.
     232 *
     233 * @param[in]  ptr      The chunk that you want to free the children of
     234 *                      (NULL is allowed too)
    237235 */
    238236void talloc_free_children(void *ptr);
     
    403401 * @param[in]  new_ctx  The new parent context.
    404402 *
    405  * @param[in]  ptr      Pointer to the talloc chunk to move.
     403 * @param[in]  pptr     Pointer to the talloc chunk to move.
    406404 *
    407405 * @return              The pointer of the talloc chunk it has been moved to,
    408406 *                      NULL on error.
    409407 */
    410 void *talloc_move(const void *new_ctx, const void *ptr);
    411 #else
    412 #define talloc_move(ctx, ptr) (_TALLOC_TYPEOF(*(ptr)))_talloc_move((ctx),(void *)(ptr))
     408void *talloc_move(const void *new_ctx, void **pptr);
     409#else
     410#define talloc_move(ctx, pptr) (_TALLOC_TYPEOF(*(pptr)))_talloc_move((ctx),(void *)(pptr))
    413411void *_talloc_move(const void *new_ctx, const void *pptr);
    414412#endif
     
    703701 * @brief Assign a type to a talloc chunk.
    704702 *
    705  * This macro allows you to force the name of a pointer to be a particular type.
    706  * This can be used in conjunction with talloc_get_type() to do type checking on
    707  * void* pointers.
     703 * This macro allows you to force the name of a pointer to be of a particular
     704 * type. This can be used in conjunction with talloc_get_type() to do type
     705 * checking on void* pointers.
    708706 *
    709707 * It is equivalent to this:
     
    906904 *   cause this pointer to be freed if it runs out of parents.
    907905 *
    908  * - you can talloc_free() the pointer itself. That will destroy the
    909  *   most recently established parent to the pointer and leave the
    910  *   pointer as a child of its current parent.
     906 * - you can talloc_free() the pointer itself if it has at maximum one
     907 *   parent. This behaviour has been changed since the release of version
     908 *   2.0. Further informations in the description of "talloc_free".
    911909 *
    912910 * For more control on which parent to remove, see talloc_unlink()
     
    943941 * a direct parent of ptr.
    944942 *
    945  * Usually you can just use talloc_free() instead of talloc_unlink(), but
    946  * sometimes it is useful to have the additional control on which parent is
    947  * removed.
     943 * You can just use talloc_free() instead of talloc_unlink() if there
     944 * is at maximum one parent. This behaviour has been changed since the
     945 * release of version 2.0. Further informations in the description of
     946 * "talloc_free".
    948947 *
    949948 * @param[in]  context  The talloc parent to remove.
     
    993992 * @brief Get the size of a talloc chunk.
    994993 *
    995  * This function lets you know the amount of memory alloced so far by
     994 * This function lets you know the amount of memory allocated so far by
    996995 * this context. It does NOT account for subcontext memory.
    997996 * This can be used to calculate the size of an array.
     
    14541453 *
    14551454 * This function appends the given formatted string to the given string. Use
    1456  * this varient when the string in the current talloc buffer may have been
     1455 * this variant when the string in the current talloc buffer may have been
    14571456 * truncated in length.
    14581457 *
     
    15521551 *
    15531552 * This provides a more detailed report than talloc_report(). It will
    1554  * recursively print the ensire tree of memory referenced by the
     1553 * recursively print the entire tree of memory referenced by the
    15551554 * pointer. References in the tree are shown by giving the name of the
    15561555 * pointer that is referenced.
  • vendor/current/lib/talloc/talloc_guide.txt

    r740 r746  
    2727
    2828and the pointer X->name would be a "child" of the talloc context "X"
    29 which is itself a child of mem_ctx. So if you do talloc_free(mem_ctx)
     29which is itself a child of "mem_ctx". So if you do talloc_free(mem_ctx)
    3030then it is all destroyed, whereas if you do talloc_free(X) then just X
    3131and X->name are destroyed, and if you do talloc_free(X->name) then
     
    6565the underlying "malloc" is), as long as each thread uses different 
    6666memory contexts.
    67 If two threads uses the same context then they need to synchronize in 
     67If two threads use the same context then they need to synchronize in
    6868order to be safe. In particular:
    6969- when using talloc_enable_leak_report(), giving directly NULL as a 
     
    137137no modifications and returns -1.
    138138
    139 If this pointer has an additional parent when talloc_free() is called
    140 then the memory is not actually released, but instead the most
    141 recently established parent is destroyed. See talloc_reference() for
    142 details on establishing additional parents.
    143 
    144 For more control on which parent is removed, see talloc_unlink()
    145 
    146 talloc_free() operates recursively on its children.
    147 
    148 From the 2.0 version of talloc, as a special case, talloc_free() is
    149 refused on pointers that have more than one parent, as talloc would
    150 have no way of knowing which parent should be removed. To free a
     139From version 2.0 and onwards, as a special case, talloc_free() is
     140refused on pointers that have more than one parent associated, as talloc
     141would have no way of knowing which parent should be removed. This is
     142different from older versions in the sense that always the reference to
     143the most recently established parent has been destroyed. Hence to free a
    151144pointer that has more than one parent please use talloc_unlink().
    152145
     
    163156functions.
    164157
    165 =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    166 int talloc_free_children(void *ptr);
     158talloc_free() operates recursively on its children.
     159
     160=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
     161void talloc_free_children(void *ptr);
    167162
    168163The talloc_free_children() walks along the list of all children of a
     
    170165itself.
    171166
     167A NULL argument is handled as no-op.
    172168
    173169=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
     
    191187    cause this pointer to be freed if it runs out of parents.
    192188
    193   - you can talloc_free() the pointer itself. That will destroy the
    194     most recently established parent to the pointer and leave the
    195     pointer as a child of its current parent.
     189  - you can talloc_free() the pointer itself if it has at maximum one
     190    parent. This behaviour has been changed since the release of version
     191    2.0. Further informations in the description of "talloc_free".
    196192
    197193For more control on which parent to remove, see talloc_unlink()
     
    209205is NULL, then the function will make no modifications and return -1.
    210206
    211 Usually you can just use talloc_free() instead of talloc_unlink(), but
    212 sometimes it is useful to have the additional control on which parent
    213 is removed.
    214 
     207You can just use talloc_free() instead of talloc_unlink() if there
     208is at maximum one parent. This behaviour has been changed since the
     209release of version 2.0. Further informations in the description of
     210"talloc_free".
    215211
    216212=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
     
    484480
    485481This provides a more detailed report than talloc_report(). It will
    486 recursively print the ensire tree of memory referenced by the
     482recursively print the entire tree of memory referenced by the
    487483pointer. References in the tree are shown by giving the name of the
    488484pointer that is referenced.
     
    643639The talloc_asprintf_append() function appends the given formatted
    644640string to the given string.
    645 Use this varient when the string in the current talloc buffer may
     641Use this variant when the string in the current talloc buffer may
    646642have been truncated in length.
    647643
     
    657653The talloc_asprintf_append() function appends the given formatted
    658654string to the end of the currently allocated talloc buffer.
    659 Use this varient when the string in the current talloc buffer has
     655Use this variant when the string in the current talloc buffer has
    660656not been changed.
    661657
     
    731727talloc_set_type(const void *ptr, type);
    732728
    733 This macro allows you to force the name of a pointer to be a
     729This macro allows you to force the name of a pointer to be of a
    734730particular type. This can be used in conjunction with
    735731talloc_get_type() to do type checking on void* pointers.
     
    742738talloc_get_size(const void *ctx);
    743739
    744 This function lets you know the amount of memory alloced so far by
     740This function lets you know the amount of memory allocated so far by
    745741this context. It does NOT account for subcontext memory.
    746742This can be used to calculate the size of an array.
     
    769765void talloc_set_log_stderr(void)
    770766
    771 This sets the talloc log function to write log messages to stderr
     767This sets the talloc log function to write log messages to stderr.
  • vendor/current/lib/talloc/testsuite.c

    r740 r746  
    13181318        talloc_report_full(root, stdout);
    13191319        talloc_free(root);
     1320        CHECK_BLOCKS("null_context", NULL, 2);
     1321        return true;
     1322}
     1323
     1324static bool test_free_children(void)
     1325{
     1326        void *root;
     1327        const char *p1, *p2, *name, *name2;
     1328
     1329        talloc_enable_null_tracking();
     1330        root = talloc_new(NULL);
     1331        p1 = talloc_strdup(root, "foo1");
     1332        p2 = talloc_strdup(p1, "foo2");
     1333
     1334        talloc_set_name(p1, "%s", "testname");
     1335        talloc_free_children(p1);
     1336        /* check its still a valid talloc ptr */
     1337        talloc_get_size(talloc_get_name(p1));
     1338        if (strcmp(talloc_get_name(p1), "testname") != 0) {
     1339                return false;
     1340        }
     1341
     1342        talloc_set_name(p1, "%s", "testname");
     1343        name = talloc_get_name(p1);
     1344        talloc_free_children(p1);
     1345        /* check its still a valid talloc ptr */
     1346        talloc_get_size(talloc_get_name(p1));
     1347        torture_assert("name", name == talloc_get_name(p1), "name ptr changed");
     1348        torture_assert("namecheck", strcmp(talloc_get_name(p1), "testname") == 0,
     1349                       "wrong name");
     1350        CHECK_BLOCKS("name1", p1, 2);
     1351
     1352        /* note that this does not free the old child name */
     1353        talloc_set_name_const(p1, "testname2");
     1354        name2 = talloc_get_name(p1);
     1355        /* but this does */
     1356        talloc_free_children(p1);
     1357        torture_assert("namecheck", strcmp(talloc_get_name(p1), "testname2") == 0,
     1358                       "wrong name");
     1359        CHECK_BLOCKS("name1", p1, 1);
     1360
     1361        talloc_report_full(root, stdout);
     1362        talloc_free(root);
    13201363        return true;
    13211364}
     
    13801423        test_reset();
    13811424        ret &= test_rusty();
     1425        test_reset();
     1426        ret &= test_free_children();
    13821427
    13831428        if (ret) {
  • vendor/current/lib/tdb/common/io.c

    r740 r746  
    5454        }
    5555
     56        /* Unmap, update size, remap */
     57        if (tdb_munmap(tdb) == -1) {
     58                tdb->ecode = TDB_ERR_IO;
     59                return -1;
     60        }
     61        tdb->map_size = st.st_size;
     62        tdb_mmap(tdb);
     63
    5664        if (st.st_size < (size_t)len) {
    5765                if (!probe) {
     
    6472        }
    6573
    66         /* Unmap, update size, remap */
    67         if (tdb_munmap(tdb) == -1) {
    68                 tdb->ecode = TDB_ERR_IO;
    69                 return -1;
    70         }
    71         tdb->map_size = st.st_size;
    72         tdb_mmap(tdb);
    7374        return 0;
    7475}
  • vendor/current/lib/tdb/common/open.c

    r740 r746  
    314314            (!tdb->read_only) &&
    315315            (locked = (tdb_nest_lock(tdb, ACTIVE_LOCK, F_WRLCK, TDB_LOCK_NOWAIT|TDB_LOCK_PROBE) == 0))) {
    316                 open_flags |= O_CREAT;
    317                 if (ftruncate(tdb->fd, 0) == -1) {
     316                int ret;
     317                ret = tdb_brlock(tdb, F_WRLCK, FREELIST_TOP, 0,
     318                                TDB_LOCK_WAIT);
     319                if (ret == -1) {
    318320                        TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_open_ex: "
    319                                  "failed to truncate %s: %s\n",
    320                                  name, strerror(errno)));
    321                         goto fail; /* errno set by ftruncate */
     321                                "tdb_brlock failed for %s: %s\n",
     322                                name, strerror(errno)));
     323                        goto fail;
     324                }
     325                ret = tdb_new_database(tdb, hash_size);
     326                if (ret == -1) {
     327                        TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_open_ex: "
     328                                "tdb_new_database failed for %s: %s\n",
     329                                name, strerror(errno)));
     330                        tdb_unlockall(tdb);
     331                        goto fail;
     332                }
     333                ret = tdb_brunlock(tdb, F_WRLCK, FREELIST_TOP, 0);
     334                if (ret == -1) {
     335                        TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_open_ex: "
     336                                "tdb_unlockall failed for %s: %s\n",
     337                                name, strerror(errno)));
     338                        goto fail;
     339                }
     340                ret = lseek(tdb->fd, 0, SEEK_SET);
     341                if (ret == -1) {
     342                        TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_open_ex: "
     343                                "lseek failed for %s: %s\n",
     344                                name, strerror(errno)));
     345                        goto fail;
    322346                }
    323347        }
  • vendor/current/lib/util/charset/iconv.c

    r740 r746  
    9797                        return c;
    9898                }
    99                 c = c->next;
    10099        }
    101100
  • vendor/current/lib/util/debug.c

    r740 r746  
    203203        TALLOC_FREE(format_bufr);
    204204
    205         debug_num_classes = DBGC_MAX_FIXED;
     205        debug_num_classes = 0;
    206206
    207207        state.initialized = false;
  • vendor/current/lib/util/debug.h

    r740 r746  
    202202struct debug_settings {
    203203        size_t max_log_size;
    204         bool syslog;
     204        int syslog;
    205205        bool syslog_only;
    206206        bool timestamp_logs;
  • vendor/current/lib/util/debug_s3.h

    r740 r746  
    1818*/
    1919
     20#include "librpc/gen_ndr/server_id.h"
     21
    2022struct messaging_context;
    2123struct server_id;
Note: See TracChangeset for help on using the changeset viewer.