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

Location:
vendor/current/lib/smbconf
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • vendor/current/lib/smbconf/smbconf.c

    r740 r988  
    232232
    233233/**
     234 * create and set the definition for a new share (service).
     235 */
     236sbcErr smbconf_create_set_share(struct smbconf_ctx *ctx,
     237                                struct smbconf_service *service)
     238{
     239        sbcErr err, err2;
     240        int i;
     241        uint32_t num_includes = 0;
     242        char **includes = NULL;
     243        TALLOC_CTX *tmp_ctx = NULL;
     244
     245        if ((service->name != NULL) && smbconf_share_exists(ctx, service->name))
     246        {
     247                return SBC_ERR_FILE_EXISTS;
     248        }
     249
     250        err = smbconf_transaction_start(ctx);
     251        if (!SBC_ERROR_IS_OK(err)) {
     252                return err;
     253        }
     254
     255        tmp_ctx = talloc_stackframe();
     256
     257        err = smbconf_create_share(ctx, service->name);
     258        if (!SBC_ERROR_IS_OK(err)) {
     259                goto cancel;
     260        }
     261
     262        for (i = 0; i < service->num_params; i++) {
     263                if (strequal(service->param_names[i], "include")) {
     264                        includes = talloc_realloc(tmp_ctx, includes, char *,
     265                                                  num_includes+1);
     266                        if (includes == NULL) {
     267                                err = SBC_ERR_NOMEM;
     268                                goto cancel;
     269                        }
     270                        includes[num_includes] = talloc_strdup(includes,
     271                                                service->param_values[i]);
     272                        if (includes[num_includes] == NULL) {
     273                                err = SBC_ERR_NOMEM;
     274                                goto cancel;
     275                        }
     276                        num_includes++;
     277                } else {
     278                        err = smbconf_set_parameter(ctx,
     279                                                    service->name,
     280                                                    service->param_names[i],
     281                                                    service->param_values[i]);
     282                        if (!SBC_ERROR_IS_OK(err)) {
     283                                goto cancel;
     284                        }
     285                }
     286        }
     287
     288        err = smbconf_set_includes(ctx, service->name, num_includes,
     289                                   discard_const_p(const char *, includes));
     290        if (!SBC_ERROR_IS_OK(err)) {
     291                goto cancel;
     292        }
     293
     294        err = smbconf_transaction_commit(ctx);
     295
     296        goto done;
     297
     298cancel:
     299        err2 = smbconf_transaction_cancel(ctx);
     300        if (!SBC_ERROR_IS_OK(err2)) {
     301                DEBUG(5, (__location__ ": Error cancelling transaction: %s\n",
     302                          sbcErrorString(err2)));
     303        }
     304
     305done:
     306        talloc_free(tmp_ctx);
     307        return err;
     308}
     309
     310/**
    234311 * get a definition of a share (service) from configuration.
    235312 */
  • vendor/current/lib/smbconf/smbconf.h

    r740 r988  
    206206
    207207/**
     208 * @brief create and set the definition for a new service.
     209 *
     210 * @param[in] ctx       The smbconf context to use.
     211 *
     212 * @param[in] service   The definition for the added service.
     213 *
     214 * @return              SBC_ERR_OK on success, a corresponding sbcErr if an
     215 *                      error occured.
     216 */
     217sbcErr smbconf_create_set_share(struct smbconf_ctx *ctx,
     218                                struct smbconf_service *service);
     219
     220/**
    208221 * @brief Get a definition of a share (service) from configuration.
    209222 *
     
    448461 * @brief Start a transaction on the configuration backend.
    449462 *
    450  * This is to speed up writes to the registry based backend.
     463 * Transactions are exposed in order to make it possible
     464 * to create atomic compound writing commands.
    451465 *
    452466 * @param[in] ctx       The smbconf context to start the transaction.
     
    460474 * @brief Commit a transaction on the configuration backend.
    461475 *
    462  * This is to speed up writes to the registry based backend.
     476 * Transactions are exposed in order to make it possible
     477 * to create atomic compound writing commands.
    463478 *
    464479 * @param[in] ctx       The smbconf context to commit the transaction.
     
    474489 * @brief Cancel a transaction on the configuration backend.
    475490 *
     491 * Transactions are exposed in order to make it possible
     492 * to create atomic compound writing commands.
     493 *
    476494 * @param[in] ctx       The smbconf context to cancel the transaction.
    477495 *
  • vendor/current/lib/smbconf/wscript_build

    r740 r988  
    1 #!/usr/bin/env python
    2 
    31bld.SAMBA_SUBSYSTEM('LIBSMBCONF',
    42                    source='smbconf.c smbconf_txt.c smbconf_util.c',
Note: See TracChangeset for help on using the changeset viewer.