summaryrefslogtreecommitdiff
path: root/source3/libsmb/smb_share_modes.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2005-09-09 21:49:49 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 11:03:33 -0500
commit1ff0de8b6d3de21325d92e7ebffbc74602a13c49 (patch)
treefafd3111a0e2e5e861cd9b44af81d58b02cf91d9 /source3/libsmb/smb_share_modes.c
parent11c79fa98fd41be7d770d7e1da8053dd4f3082a8 (diff)
downloadsamba-1ff0de8b6d3de21325d92e7ebffbc74602a13c49.tar.gz
samba-1ff0de8b6d3de21325d92e7ebffbc74602a13c49.tar.bz2
samba-1ff0de8b6d3de21325d92e7ebffbc74602a13c49.zip
r10135: Remove external dependencies for libsmbsharemodes.so
Jeremy. (This used to be commit 2521ae826f1a0344c882090832646d56f248488f)
Diffstat (limited to 'source3/libsmb/smb_share_modes.c')
-rw-r--r--source3/libsmb/smb_share_modes.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/source3/libsmb/smb_share_modes.c b/source3/libsmb/smb_share_modes.c
index 180b5b4bfd..1c95fe1a30 100644
--- a/source3/libsmb/smb_share_modes.c
+++ b/source3/libsmb/smb_share_modes.c
@@ -22,13 +22,18 @@
#include "includes.h"
#include "smb_share_modes.h"
+/* Remove the paranoid malloc checker. */
+#ifdef malloc
+#undef malloc
+#endif
+
/*
* open/close sharemode database.
*/
struct smbdb_ctx *smb_share_mode_db_open(const char *db_path)
{
- struct smbdb_ctx *smb_db = SMB_MALLOC_P(struct smbdb_ctx);
+ struct smbdb_ctx *smb_db = (struct smbdb_ctx *)malloc(sizeof(struct smbdb_ctx));
if (!smb_db) {
return NULL;
@@ -36,11 +41,7 @@ struct smbdb_ctx *smb_share_mode_db_open(const char *db_path)
memset(smb_db, '\0', sizeof(struct smbdb_ctx));
- if (!db_path) {
- db_path = lock_path("locking.tdb");
- }
-
- smb_db->smb_tdb = tdb_open_log(db_path,
+ smb_db->smb_tdb = tdb_open(db_path,
0, TDB_DEFAULT|TDB_CLEAR_IF_FIRST,
O_RDWR|O_CREAT,
0644);
@@ -184,7 +185,7 @@ int smb_get_share_mode_entries(struct smbdb_ctx *db_ctx,
return 0;
}
- list = SMB_MALLOC_ARRAY(struct smb_share_mode_entry, num_share_modes);
+ list = (struct smb_share_mode_entry *)malloc(sizeof(struct smb_share_mode_entry)*num_share_modes);
if (!list) {
free(db_data.dptr);
return -1;
@@ -247,7 +248,7 @@ int smb_create_share_mode_entry(struct smbdb_ctx *db_ctx,
db_data = tdb_fetch(db_ctx->smb_tdb, locking_key);
if (!db_data.dptr) {
/* We must create the entry. */
- db_data.dptr = SMB_MALLOC(sizeof(struct locking_data) + sizeof(share_mode_entry) + strlen(filename) + 1);
+ db_data.dptr = malloc(sizeof(struct locking_data) + sizeof(share_mode_entry) + strlen(filename) + 1);
if (!db_data.dptr) {
return -1;
}
@@ -270,7 +271,7 @@ int smb_create_share_mode_entry(struct smbdb_ctx *db_ctx,
}
/* Entry exists, we must add a new entry. */
- new_data_p = SMB_MALLOC(db_data.dsize + sizeof(share_mode_entry));
+ new_data_p = malloc(db_data.dsize + sizeof(share_mode_entry));
if (!new_data_p) {
free(db_data.dptr);
return -1;
@@ -345,7 +346,7 @@ int smb_delete_share_mode_entry(struct smbdb_ctx *db_ctx,
}
/* More than one - allocate a new record minus the one we'll delete. */
- new_data_p = SMB_MALLOC(db_data.dsize - sizeof(share_mode_entry));
+ new_data_p = malloc(db_data.dsize - sizeof(share_mode_entry));
if (!new_data_p) {
free(db_data.dptr);
return -1;