diff options
Diffstat (limited to 'source3')
-rw-r--r-- | source3/lib/dbwrap_ctdb.c | 12 | ||||
-rw-r--r-- | source3/lib/smbconf/smbconf_reg.c | 13 | ||||
-rw-r--r-- | source3/modules/vfs_acl_tdb.c | 4 | ||||
-rw-r--r-- | source3/modules/vfs_acl_xattr.c | 2 | ||||
-rw-r--r-- | source3/utils/net_conf.c | 39 |
5 files changed, 51 insertions, 19 deletions
diff --git a/source3/lib/dbwrap_ctdb.c b/source3/lib/dbwrap_ctdb.c index 03667ff355..4a5bf6d81a 100644 --- a/source3/lib/dbwrap_ctdb.c +++ b/source3/lib/dbwrap_ctdb.c @@ -121,9 +121,9 @@ static struct ctdb_marshall_buffer *db_ctdb_marshall_add(TALLOC_CTX *mem_ctx, { struct ctdb_rec_data *r; size_t m_size, r_size; - struct ctdb_marshall_buffer *m2; + struct ctdb_marshall_buffer *m2 = NULL; - r = db_ctdb_marshall_record(mem_ctx, reqid, key, header, data); + r = db_ctdb_marshall_record(talloc_tos(), reqid, key, header, data); if (r == NULL) { talloc_free(m); return NULL; @@ -133,7 +133,7 @@ static struct ctdb_marshall_buffer *db_ctdb_marshall_add(TALLOC_CTX *mem_ctx, m = (struct ctdb_marshall_buffer *)talloc_zero_size( mem_ctx, offsetof(struct ctdb_marshall_buffer, data)); if (m == NULL) { - return NULL; + goto done; } m->db_id = db_id; } @@ -145,15 +145,15 @@ static struct ctdb_marshall_buffer *db_ctdb_marshall_add(TALLOC_CTX *mem_ctx, mem_ctx, m, m_size + r_size); if (m2 == NULL) { talloc_free(m); - return NULL; + goto done; } memcpy(m_size + (uint8_t *)m2, r, r_size); - talloc_free(r); - m2->count++; +done: + talloc_free(r); return m2; } diff --git a/source3/lib/smbconf/smbconf_reg.c b/source3/lib/smbconf/smbconf_reg.c index 5a5c0ead65..ae6a41151d 100644 --- a/source3/lib/smbconf/smbconf_reg.c +++ b/source3/lib/smbconf/smbconf_reg.c @@ -80,12 +80,20 @@ static WERROR smbconf_reg_open_service_key(TALLOC_CTX *mem_ctx, uint32 desired_access, struct registry_key **key) { + WERROR werr; + if (servicename == NULL) { *key = rpd(ctx)->base_key; return WERR_OK; } - return reg_openkey(mem_ctx, rpd(ctx)->base_key, servicename, + werr = reg_openkey(mem_ctx, rpd(ctx)->base_key, servicename, desired_access, key); + + if (W_ERROR_EQUAL(werr, WERR_BADFILE)) { + werr = WERR_NO_SUCH_SERVICE; + } + + return werr; } /** @@ -828,9 +836,6 @@ static WERROR smbconf_reg_get_share(struct smbconf_ctx *ctx, werr = smbconf_reg_open_service_key(tmp_ctx, ctx, servicename, REG_KEY_READ, &key); if (!W_ERROR_IS_OK(werr)) { - if (W_ERROR_EQUAL(werr, WERR_BADFILE)) { - werr = WERR_NO_SUCH_SERVICE; - } goto done; } diff --git a/source3/modules/vfs_acl_tdb.c b/source3/modules/vfs_acl_tdb.c index 73dbca4809..a77f6d60f4 100644 --- a/source3/modules/vfs_acl_tdb.c +++ b/source3/modules/vfs_acl_tdb.c @@ -195,7 +195,7 @@ static NTSTATUS get_acl_blob(TALLOC_CTX *ctx, if (fsp && fsp->fh->fd != -1) { ret = SMB_VFS_FSTAT(fsp, &sbuf); } else { - if (fsp->posix_open) { + if (fsp && fsp->posix_open) { ret = SMB_VFS_LSTAT(handle->conn, name, &sbuf); } else { ret = SMB_VFS_STAT(handle->conn, name, &sbuf); @@ -513,7 +513,7 @@ static NTSTATUS inherit_new_acl(vfs_handle_struct *handle, if (fsp && !fsp->is_directory && fsp->fh->fd != -1) { ret = SMB_VFS_FSTAT(fsp, &sbuf); } else { - if (fsp->posix_open) { + if (fsp && fsp->posix_open) { ret = SMB_VFS_LSTAT(handle->conn,fname, &sbuf); } else { ret = SMB_VFS_STAT(handle->conn,fname, &sbuf); diff --git a/source3/modules/vfs_acl_xattr.c b/source3/modules/vfs_acl_xattr.c index 039e469426..49e4899879 100644 --- a/source3/modules/vfs_acl_xattr.c +++ b/source3/modules/vfs_acl_xattr.c @@ -381,7 +381,7 @@ static NTSTATUS inherit_new_acl(vfs_handle_struct *handle, if (fsp && !fsp->is_directory && fsp->fh->fd != -1) { ret = SMB_VFS_FSTAT(fsp, &sbuf); } else { - if (fsp->posix_open) { + if (fsp && fsp->posix_open) { ret = SMB_VFS_LSTAT(handle->conn,fname, &sbuf); } else { ret = SMB_VFS_STAT(handle->conn,fname, &sbuf); diff --git a/source3/utils/net_conf.c b/source3/utils/net_conf.c index 05b552c00d..38a2553e53 100644 --- a/source3/utils/net_conf.c +++ b/source3/utils/net_conf.c @@ -331,12 +331,6 @@ static int net_conf_import(struct net_context *c, struct smbconf_ctx *conf_ctx, "would import the following configuration:\n\n"); } - werr = smbconf_transaction_start(conf_ctx); - if (!W_ERROR_IS_OK(werr)) { - d_printf("error starting transaction: %s\n", win_errstr(werr)); - goto done; - } - if (servicename != NULL) { struct smbconf_service *service = NULL; @@ -366,12 +360,45 @@ static int net_conf_import(struct net_context *c, struct smbconf_ctx *conf_ctx, goto cancel; } } + + /* + * Wrap the importing of shares into a transaction, + * but only 100 at a time, in order to serve memory. + * The allocated memory accumulates across the actions + * within the transaction, and for me, some 1500 + * imported shares, the MAX_TALLOC_SIZE of 256 MB + * was exceeded. + */ + werr = smbconf_transaction_start(conf_ctx); + if (!W_ERROR_IS_OK(werr)) { + d_printf("error starting transaction: %s\n", + win_errstr(werr)); + goto done; + } + for (sidx = 0; sidx < num_shares; sidx++) { werr = import_process_service(c, conf_ctx, services[sidx]); if (!W_ERROR_IS_OK(werr)) { goto cancel; } + + if (sidx % 100) { + continue; + } + + werr = smbconf_transaction_commit(conf_ctx); + if (!W_ERROR_IS_OK(werr)) { + d_printf("error committing transaction: %s\n", + win_errstr(werr)); + goto done; + } + werr = smbconf_transaction_start(conf_ctx); + if (!W_ERROR_IS_OK(werr)) { + d_printf("error starting transaction: %s\n", + win_errstr(werr)); + goto done; + } } } |