diff options
author | James Peach <jpeach@samba.org> | 2007-06-15 21:58:49 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:23:23 -0500 |
commit | b1ce226af8b61ad7e3c37860a59c6715012e738b (patch) | |
tree | 4067151ac0de549002434afb9f42e75f052c6754 | |
parent | aa4110e6f2432d76926198ce7a2a4adea4e1860a (diff) | |
download | samba-b1ce226af8b61ad7e3c37860a59c6715012e738b.tar.gz samba-b1ce226af8b61ad7e3c37860a59c6715012e738b.tar.bz2 samba-b1ce226af8b61ad7e3c37860a59c6715012e738b.zip |
r23510: Tidy calls to smb_panic by removing trailing newlines. Print the
failed expression in SMB_ASSERT.
(This used to be commit 171dc060e2a576d724eed1ca65636bdafffd7713)
33 files changed, 120 insertions, 113 deletions
diff --git a/source3/groupdb/mapping.c b/source3/groupdb/mapping.c index 9ead1c6317..4d0d01b898 100644 --- a/source3/groupdb/mapping.c +++ b/source3/groupdb/mapping.c @@ -50,7 +50,7 @@ static BOOL init_group_mapping(void) backend = groupdb_tdb_init(); } else { DEBUG(0,("Unknown groupdb backend '%s'\n", backend_string)); - smb_panic("Unknown groupdb backend\n"); + smb_panic("Unknown groupdb backend"); } return backend != NULL; } diff --git a/source3/include/smb_macros.h b/source3/include/smb_macros.h index 646c6bdce0..81d4dc0666 100644 --- a/source3/include/smb_macros.h +++ b/source3/include/smb_macros.h @@ -49,12 +49,13 @@ /* assert macros */ #ifdef DEVELOPER #define SMB_ASSERT(b) ( (b) ? (void)0 : \ - (DEBUG(0,("PANIC: assert failed at %s(%d)\n", \ - __FILE__, __LINE__)), smb_panic("assert failed"))) + (DEBUG(0,("PANIC: assert failed at %s(%d): %s\n", \ + __FILE__, __LINE__, #b)), smb_panic("assert failed: " #b))) #else /* redefine the assert macro for non-developer builds */ #define SMB_ASSERT(b) ( (b) ? (void)0 : \ - (DEBUG(0,("PANIC: assert failed at %s(%d)\n", __FILE__, __LINE__)))) + (DEBUG(0,("PANIC: assert failed at %s(%d): %s\n", \ + __FILE__, __LINE__, #b)))) #endif #define SMB_WARN(condition, message) \ diff --git a/source3/lib/charcnv.c b/source3/lib/charcnv.c index 8d5fbc8118..35343b2f0a 100644 --- a/source3/lib/charcnv.c +++ b/source3/lib/charcnv.c @@ -168,7 +168,7 @@ void init_iconv(void) conv_handles[c1][c2] = smb_iconv_open(n2,n1); if (!conv_handles[c1][c2]) { DEBUG(0,("init_iconv: Conversion from %s to %s failed", n1, n2)); - smb_panic("init_iconv: conv_handle initialization failed."); + smb_panic("init_iconv: conv_handle initialization failed"); } } } diff --git a/source3/lib/data_blob.c b/source3/lib/data_blob.c index 6ed48888a8..ebe97230e4 100644 --- a/source3/lib/data_blob.c +++ b/source3/lib/data_blob.c @@ -74,11 +74,11 @@ DATA_BLOB data_blob_talloc(TALLOC_CTX *mem_ctx, const void *p, size_t length) if (p) { ret.data = (uint8 *)TALLOC_MEMDUP(mem_ctx, p, length); if (ret.data == NULL) - smb_panic("data_blob_talloc: TALLOC_MEMDUP failed.\n"); + smb_panic("data_blob_talloc: TALLOC_MEMDUP failed"); } else { ret.data = (uint8 *)TALLOC(mem_ctx, length); if (ret.data == NULL) - smb_panic("data_blob_talloc: talloc failed.\n"); + smb_panic("data_blob_talloc: TALLOC failed"); } ret.length = length; diff --git a/source3/lib/select.c b/source3/lib/select.c index f63221f7cf..e8900a383c 100644 --- a/source3/lib/select.c +++ b/source3/lib/select.c @@ -71,9 +71,9 @@ int sys_select(int maxfd, fd_set *readfds, fd_set *writefds, fd_set *errorfds, s */ if(set_blocking(select_pipe[0],0)==-1) - smb_panic("select_pipe[0]: O_NONBLOCK failed.\n"); + smb_panic("select_pipe[0]: O_NONBLOCK failed"); if(set_blocking(select_pipe[1],0)==-1) - smb_panic("select_pipe[1]: O_NONBLOCK failed.\n"); + smb_panic("select_pipe[1]: O_NONBLOCK failed"); initialised = sys_getpid(); } diff --git a/source3/lib/smbldap.c b/source3/lib/smbldap.c index f8cb8f4a25..1cfb5f89a7 100644 --- a/source3/lib/smbldap.c +++ b/source3/lib/smbldap.c @@ -409,9 +409,8 @@ ATTRIB_MAP_ENTRY sidmap_attr_list[] = { if (mods == NULL) { mods = SMB_MALLOC_P(LDAPMod *); if (mods == NULL) { - smb_panic("smbldap_set_mod: out of memory!\n"); + smb_panic("smbldap_set_mod: out of memory!"); /* notreached. */ - abort(); } mods[0] = NULL; } @@ -424,15 +423,13 @@ ATTRIB_MAP_ENTRY sidmap_attr_list[] = { if (mods[i] == NULL) { mods = SMB_REALLOC_ARRAY (mods, LDAPMod *, i + 2); if (mods == NULL) { - smb_panic("smbldap_set_mod: out of memory!\n"); + smb_panic("smbldap_set_mod: out of memory!"); /* notreached. */ - abort(); } mods[i] = SMB_MALLOC_P(LDAPMod); if (mods[i] == NULL) { - smb_panic("smbldap_set_mod: out of memory!\n"); + smb_panic("smbldap_set_mod: out of memory!"); /* notreached. */ - abort(); } mods[i]->mod_op = modop; mods[i]->mod_values = NULL; @@ -450,15 +447,13 @@ ATTRIB_MAP_ENTRY sidmap_attr_list[] = { mods[i]->mod_values = SMB_REALLOC_ARRAY(mods[i]->mod_values, char *, j + 2); if (mods[i]->mod_values == NULL) { - smb_panic("smbldap_set_mod: out of memory!\n"); + smb_panic("smbldap_set_mod: out of memory!"); /* notreached. */ - abort(); } if (push_utf8_allocate(&utf8_value, value) == (size_t)-1) { - smb_panic("smbldap_set_mod: String conversion failure!\n"); + smb_panic("smbldap_set_mod: String conversion failure!"); /* notreached. */ - abort(); } mods[i]->mod_values[j] = utf8_value; diff --git a/source3/lib/system_smbd.c b/source3/lib/system_smbd.c index 0d62360ca6..8159f3a3b5 100644 --- a/source3/lib/system_smbd.c +++ b/source3/lib/system_smbd.c @@ -107,9 +107,7 @@ static int getgrouplist_internals(const char *user, gid_t gid, gid_t *groups, if (sys_setgroups(gid, ngrp_saved, gids_saved) != 0) { /* yikes! */ DEBUG(0,("ERROR: getgrouplist: failed to reset group list!\n")); - smb_panic("getgrouplist: failed to reset group list!\n"); - free(gids_saved); - return -1; + smb_panic("getgrouplist: failed to reset group list!"); } free(gids_saved); diff --git a/source3/lib/util.c b/source3/lib/util.c index 3d72eb5d29..7a927fb3e8 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -2469,15 +2469,16 @@ int smb_mkstemp(char *name_template) void *smb_xmalloc_array(size_t size, unsigned int count) { void *p; - if (size == 0) - smb_panic("smb_xmalloc_array: called with zero size.\n"); + if (size == 0) { + smb_panic("smb_xmalloc_array: called with zero size"); + } if (count >= MAX_ALLOC_SIZE/size) { - smb_panic("smb_xmalloc: alloc size too large.\n"); + smb_panic("smb_xmalloc_array: alloc size too large"); } if ((p = SMB_MALLOC(size*count)) == NULL) { DEBUG(0, ("smb_xmalloc_array failed to allocate %lu * %lu bytes\n", (unsigned long)size, (unsigned long)count)); - smb_panic("smb_xmalloc_array: malloc fail.\n"); + smb_panic("smb_xmalloc_array: malloc failed"); } return p; } @@ -2517,8 +2518,9 @@ char *smb_xstrdup(const char *s) #endif #define strdup(s) __ERROR_DONT_USE_STRDUP_DIRECTLY #endif - if (!s1) - smb_panic("smb_xstrdup: malloc fail\n"); + if (!s1) { + smb_panic("smb_xstrdup: malloc failed"); + } return s1; } @@ -2547,8 +2549,9 @@ char *smb_xstrndup(const char *s, size_t n) #endif #define strndup(s,n) __ERROR_DONT_USE_STRNDUP_DIRECTLY #endif - if (!s1) - smb_panic("smb_xstrndup: malloc fail\n"); + if (!s1) { + smb_panic("smb_xstrndup: malloc failed"); + } return s1; } @@ -2564,8 +2567,9 @@ char *smb_xstrndup(const char *s, size_t n) VA_COPY(ap2, ap); n = vasprintf(ptr, format, ap2); - if (n == -1 || ! *ptr) + if (n == -1 || ! *ptr) { smb_panic("smb_xvasprintf: out of memory"); + } return n; } @@ -2998,7 +3002,7 @@ void *talloc_check_name_abort(const void *ptr, const char *name) DEBUG(0, ("Talloc type mismatch, expected %s, got %s\n", name, talloc_get_name(ptr))); - smb_panic("aborting"); + smb_panic("talloc type mismatch"); /* Keep the compiler happy */ return NULL; } diff --git a/source3/lib/util_pw.c b/source3/lib/util_pw.c index 52054ce90a..2c8f2d4a7d 100644 --- a/source3/lib/util_pw.c +++ b/source3/lib/util_pw.c @@ -49,7 +49,7 @@ static void init_pwnam_cache(void) pwnam_cache = TALLOC_ZERO_ARRAY(NULL, struct passwd *, PWNAMCACHE_SIZE); if (pwnam_cache == NULL) { - smb_panic("Could not init pwnam_cache\n"); + smb_panic("Could not init pwnam_cache"); } return; diff --git a/source3/lib/util_tdb.c b/source3/lib/util_tdb.c index 4e0d16c354..6d783198d6 100644 --- a/source3/lib/util_tdb.c +++ b/source3/lib/util_tdb.c @@ -802,7 +802,7 @@ int tdb_trans_store(struct tdb_context *tdb, TDB_DATA key, TDB_DATA dbuf, if ((res = tdb_store(tdb, key, dbuf, flag)) != 0) { DEBUG(10, ("tdb_store failed\n")); if (tdb_transaction_cancel(tdb) != 0) { - smb_panic("Cancelling transaction failed\n"); + smb_panic("Cancelling transaction failed"); } return res; } @@ -831,7 +831,7 @@ int tdb_trans_delete(struct tdb_context *tdb, TDB_DATA key) if ((res = tdb_delete(tdb, key)) != 0) { DEBUG(10, ("tdb_delete failed\n")); if (tdb_transaction_cancel(tdb) != 0) { - smb_panic("Cancelling transaction failed\n"); + smb_panic("Cancelling transaction failed"); } return res; } diff --git a/source3/libsmb/cliquota.c b/source3/libsmb/cliquota.c index 2a47ae2463..8bba453d52 100644 --- a/source3/libsmb/cliquota.c +++ b/source3/libsmb/cliquota.c @@ -54,8 +54,9 @@ static BOOL parse_user_quota_record(const char *rdata, unsigned int rdata_count, ZERO_STRUCT(qt); - if (!rdata||!offset||!pqt) - smb_panic("parse_quota_record: called with NULL POINTER!\n"); + if (!rdata||!offset||!pqt) { + smb_panic("parse_quota_record: called with NULL POINTER!"); + } if (rdata_count < 40) { return False; @@ -138,8 +139,9 @@ BOOL cli_get_user_quota(struct cli_state *cli, int quota_fnum, SMB_NTQUOTA_STRUC unsigned int sid_len; unsigned int offset; - if (!cli||!pqt) + if (!cli||!pqt) { smb_panic("cli_get_user_quota() called with NULL Pointer!"); + } setup = NT_TRANSACT_GET_USER_QUOTA; @@ -204,8 +206,9 @@ BOOL cli_set_user_quota(struct cli_state *cli, int quota_fnum, SMB_NTQUOTA_STRUC unsigned int sid_len; memset(data,'\0',112); - if (!cli||!pqt) + if (!cli||!pqt) { smb_panic("cli_set_user_quota() called with NULL Pointer!"); + } setup = NT_TRANSACT_SET_USER_QUOTA; @@ -265,8 +268,9 @@ BOOL cli_list_user_quota(struct cli_state *cli, int quota_fnum, SMB_NTQUOTA_LIST SMB_NTQUOTA_STRUCT qt; SMB_NTQUOTA_LIST *tmp_list_ent; - if (!cli||!pqt_list) + if (!cli||!pqt_list) { smb_panic("cli_list_user_quota() called with NULL Pointer!"); + } setup = NT_TRANSACT_GET_USER_QUOTA; @@ -419,8 +423,9 @@ BOOL cli_get_fs_quota_info(struct cli_state *cli, int quota_fnum, SMB_NTQUOTA_ST SMB_NTQUOTA_STRUCT qt; ZERO_STRUCT(qt); - if (!cli||!pqt) + if (!cli||!pqt) { smb_panic("cli_get_fs_quota_info() called with NULL Pointer!"); + } setup = TRANSACT2_QFSINFO; @@ -507,8 +512,9 @@ BOOL cli_set_fs_quota_info(struct cli_state *cli, int quota_fnum, SMB_NTQUOTA_ST ZERO_STRUCT(qt); memset(data,'\0',48); - if (!cli||!pqt) + if (!cli||!pqt) { smb_panic("cli_set_fs_quota_info() called with NULL Pointer!"); + } setup = TRANSACT2_SETFSINFO; @@ -577,8 +583,9 @@ static char *quota_str_static(SMB_BIG_UINT val, BOOL special, BOOL _numeric) void dump_ntquota(SMB_NTQUOTA_STRUCT *qt, BOOL _verbose, BOOL _numeric, void (*_sidtostring)(fstring str, DOM_SID *sid, BOOL _numeric)) { - if (!qt) + if (!qt) { smb_panic("dump_ntquota() called with NULL pointer"); + } switch (qt->qtype) { case SMB_USER_FS_QUOTA_TYPE: diff --git a/source3/locking/brlock.c b/source3/locking/brlock.c index 6713530738..e0cc4eec1e 100644 --- a/source3/locking/brlock.c +++ b/source3/locking/brlock.c @@ -577,9 +577,9 @@ OR } /* Never get here. */ - smb_panic("brlock_posix_split_merge\n"); + smb_panic("brlock_posix_split_merge"); /* Notreached. */ - abort(); + /* Keep some compilers happy. */ return 0; } @@ -1309,7 +1309,7 @@ void brl_close_fnum(struct messaging_context *msg_ctx, if (br_lck->num_locks) { locks_copy = (struct lock_struct *)TALLOC_MEMDUP(br_lck, locks, br_lck->num_locks * sizeof(struct lock_struct)); if (!locks_copy) { - smb_panic("brl_close_fnum: talloc fail.\n"); + smb_panic("brl_close_fnum: talloc failed"); } } else { locks_copy = NULL; @@ -1562,7 +1562,7 @@ static int byte_range_lock_destructor(struct byte_range_lock *br_lck) if (!NT_STATUS_IS_OK(status)) { DEBUG(0, ("delete_rec returned %s\n", nt_errstr(status))); - smb_panic("Could not delete byte range lock entry\n"); + smb_panic("Could not delete byte range lock entry"); } } else { TDB_DATA data; @@ -1575,7 +1575,7 @@ static int byte_range_lock_destructor(struct byte_range_lock *br_lck) TDB_REPLACE); if (!NT_STATUS_IS_OK(status)) { DEBUG(0, ("store returned %s\n", nt_errstr(status))); - smb_panic("Could not store byte range mode entry\n"); + smb_panic("Could not store byte range mode entry"); } } diff --git a/source3/locking/locking.c b/source3/locking/locking.c index 8070f4b9b3..6f7d2d53c6 100644 --- a/source3/locking/locking.c +++ b/source3/locking/locking.c @@ -479,7 +479,7 @@ static BOOL parse_share_modes(TDB_DATA dbuf, struct share_mode_lock *lck) int i; if (dbuf.dsize < sizeof(struct locking_data)) { - smb_panic("PANIC: parse_share_modes: buffer too short.\n"); + smb_panic("parse_share_modes: buffer too short"); } data = (struct locking_data *)dbuf.dptr; @@ -495,7 +495,7 @@ static BOOL parse_share_modes(TDB_DATA dbuf, struct share_mode_lock *lck) if ((lck->num_share_modes < 0) || (lck->num_share_modes > 1000000)) { DEBUG(0, ("invalid number of share modes: %d\n", lck->num_share_modes)); - smb_panic("PANIC: invalid number of share modes"); + smb_panic("parse_share_modes: invalid number of share modes"); } lck->share_modes = NULL; @@ -505,7 +505,7 @@ static BOOL parse_share_modes(TDB_DATA dbuf, struct share_mode_lock *lck) if (dbuf.dsize < (sizeof(struct locking_data) + (lck->num_share_modes * sizeof(struct share_mode_entry)))) { - smb_panic("PANIC: parse_share_modes: buffer too short.\n"); + smb_panic("parse_share_modes: buffer too short"); } lck->share_modes = (struct share_mode_entry *) @@ -514,7 +514,7 @@ static BOOL parse_share_modes(TDB_DATA dbuf, struct share_mode_lock *lck) sizeof(struct share_mode_entry)); if (lck->share_modes == NULL) { - smb_panic("talloc failed\n"); + smb_panic("parse_share_modes: talloc failed"); } } @@ -528,12 +528,12 @@ static BOOL parse_share_modes(TDB_DATA dbuf, struct share_mode_lock *lck) ((data->u.s.delete_token_size - sizeof(uid_t)) % sizeof(gid_t)) != 0) { DEBUG(0, ("parse_share_modes: invalid token size %d\n", data->u.s.delete_token_size)); - smb_panic("parse_share_modes: invalid token size\n"); + smb_panic("parse_share_modes: invalid token size"); } lck->delete_token = TALLOC_P(lck, UNIX_USER_TOKEN); if (!lck->delete_token) { - smb_panic("talloc failed\n"); + smb_panic("parse_share_modes: talloc failed"); } /* Copy out the uid and gid. */ @@ -552,7 +552,7 @@ static BOOL parse_share_modes(TDB_DATA dbuf, struct share_mode_lock *lck) lck->delete_token->groups = TALLOC_ARRAY(lck->delete_token, gid_t, lck->delete_token->ngroups); if (!lck->delete_token) { - smb_panic("talloc failed\n"); + smb_panic("parse_share_modes: talloc failed"); } for (i = 0; i < lck->delete_token->ngroups; i++) { @@ -571,7 +571,7 @@ static BOOL parse_share_modes(TDB_DATA dbuf, struct share_mode_lock *lck) sizeof(struct share_mode_entry)) + data->u.s.delete_token_size ); if (lck->servicepath == NULL) { - smb_panic("talloc_strdup failed\n"); + smb_panic("parse_share_modes: talloc_strdup failed"); } lck->filename = talloc_strdup(lck, (const char *)dbuf.dptr + sizeof(*data) + @@ -580,7 +580,7 @@ static BOOL parse_share_modes(TDB_DATA dbuf, struct share_mode_lock *lck) data->u.s.delete_token_size + strlen(lck->servicepath) + 1 ); if (lck->filename == NULL) { - smb_panic("talloc_strdup failed\n"); + smb_panic("parse_share_modes: talloc_strdup failed"); } /* @@ -637,7 +637,7 @@ static TDB_DATA unparse_share_modes(struct share_mode_lock *lck) result.dptr = TALLOC_ARRAY(lck, uint8, result.dsize); if (result.dptr == NULL) { - smb_panic("talloc failed\n"); + smb_panic("talloc failed"); } data = (struct locking_data *)result.dptr; @@ -703,7 +703,7 @@ static int share_mode_lock_destructor(struct share_mode_lock *lck) if (!NT_STATUS_IS_OK(status)) { DEBUG(0, ("delete_rec returned %s\n", nt_errstr(status))); - smb_panic("Could not delete share entry\n"); + smb_panic("could not delete share entry"); } } goto done; @@ -712,7 +712,7 @@ static int share_mode_lock_destructor(struct share_mode_lock *lck) status = lck->record->store(lck->record, data, TDB_REPLACE); if (!NT_STATUS_IS_OK(status)) { DEBUG(0, ("store returned %s\n", nt_errstr(status))); - smb_panic("Could not store share mode entry\n"); + smb_panic("could not store share mode entry"); } done: diff --git a/source3/locking/posix.c b/source3/locking/posix.c index 73fc2c7bd0..0b38d289d8 100644 --- a/source3/locking/posix.c +++ b/source3/locking/posix.c @@ -434,7 +434,7 @@ static void increment_windows_lock_ref_count(files_struct *fsp) if (dbuf.dptr == NULL) { dbuf.dptr = (uint8 *)SMB_MALLOC_P(int); if (!dbuf.dptr) { - smb_panic("increment_windows_lock_ref_count: malloc fail.\n"); + smb_panic("increment_windows_lock_ref_count: malloc fail"); } memset(dbuf.dptr, '\0', sizeof(int)); dbuf.dsize = sizeof(int); @@ -445,7 +445,7 @@ static void increment_windows_lock_ref_count(files_struct *fsp) memcpy(dbuf.dptr, &lock_ref_count, sizeof(int)); if (tdb_store(posix_pending_close_tdb, kbuf, dbuf, TDB_REPLACE) == -1) { - smb_panic("increment_windows_lock_ref_count: tdb_store_fail.\n"); + smb_panic("increment_windows_lock_ref_count: tdb_store_fail"); } SAFE_FREE(dbuf.dptr); @@ -461,7 +461,7 @@ static void decrement_windows_lock_ref_count(files_struct *fsp) dbuf = tdb_fetch(posix_pending_close_tdb, kbuf); if (!dbuf.dptr) { - smb_panic("decrement_windows_lock_ref_count: logic error.\n"); + smb_panic("decrement_windows_lock_ref_count: logic error"); } memcpy(&lock_ref_count, dbuf.dptr, sizeof(int)); @@ -469,11 +469,11 @@ static void decrement_windows_lock_ref_count(files_struct *fsp) memcpy(dbuf.dptr, &lock_ref_count, sizeof(int)); if (lock_ref_count < 0) { - smb_panic("decrement_windows_lock_ref_count: lock_count logic error.\n"); + smb_panic("decrement_windows_lock_ref_count: lock_count logic error"); } if (tdb_store(posix_pending_close_tdb, kbuf, dbuf, TDB_REPLACE) == -1) { - smb_panic("decrement_windows_lock_ref_count: tdb_store_fail.\n"); + smb_panic("decrement_windows_lock_ref_count: tdb_store_fail"); } SAFE_FREE(dbuf.dptr); @@ -500,12 +500,12 @@ void reduce_windows_lock_ref_count(files_struct *fsp, unsigned int dcount) lock_ref_count -= dcount; if (lock_ref_count < 0) { - smb_panic("reduce_windows_lock_ref_count: lock_count logic error.\n"); + smb_panic("reduce_windows_lock_ref_count: lock_count logic error"); } memcpy(dbuf.dptr, &lock_ref_count, sizeof(int)); if (tdb_store(posix_pending_close_tdb, kbuf, dbuf, TDB_REPLACE) == -1) { - smb_panic("reduce_windows_lock_ref_count: tdb_store_fail.\n"); + smb_panic("reduce_windows_lock_ref_count: tdb_store_fail"); } SAFE_FREE(dbuf.dptr); @@ -565,14 +565,14 @@ static void add_fd_to_close_entry(files_struct *fsp) dbuf.dptr = (uint8 *)SMB_REALLOC(dbuf.dptr, dbuf.dsize + sizeof(int)); if (!dbuf.dptr) { - smb_panic("add_fd_to_close_entry: Realloc fail !\n"); + smb_panic("add_fd_to_close_entry: SMB_REALLOC failed"); } memcpy(dbuf.dptr + dbuf.dsize, &fsp->fh->fd, sizeof(int)); dbuf.dsize += sizeof(int); if (tdb_store(posix_pending_close_tdb, kbuf, dbuf, TDB_REPLACE) == -1) { - smb_panic("add_fd_to_close_entry: tdb_store_fail.\n"); + smb_panic("add_fd_to_close_entry: tdb_store_fail"); } DEBUG(10,("add_fd_to_close_entry: added fd %d file %s\n", @@ -590,7 +590,7 @@ static void delete_close_entries(files_struct *fsp) TDB_DATA kbuf = fd_array_key_fsp(fsp); if (tdb_delete(posix_pending_close_tdb, kbuf) == -1) { - smb_panic("delete_close_entries: tdb_delete fail !\n"); + smb_panic("delete_close_entries: tdb_delete failed"); } } @@ -934,7 +934,7 @@ new: start=%.0f,size=%.0f\n", (double)l_curr->start, (double)l_curr->size, pstring msg; slprintf(msg, sizeof(msg)-1, "logic flaw in cases: l_curr: start = %.0f, size = %.0f : \ -lock: start = %.0f, size = %.0f\n", (double)l_curr->start, (double)l_curr->size, (double)lock->start, (double)lock->size ); +lock: start = %.0f, size = %.0f", (double)l_curr->start, (double)l_curr->size, (double)lock->start, (double)lock->size ); smb_panic(msg); } diff --git a/source3/nmbd/nmbd.c b/source3/nmbd/nmbd.c index 8c94ad842b..d367dc70fb 100644 --- a/source3/nmbd/nmbd.c +++ b/source3/nmbd/nmbd.c @@ -45,7 +45,7 @@ struct event_context *nmbd_event_context(void) static struct event_context *ctx; if (!ctx && !(ctx = event_context_init(NULL))) { - smb_panic("Could not init nmbd event context\n"); + smb_panic("Could not init nmbd event context"); } return ctx; } @@ -56,7 +56,7 @@ struct messaging_context *nmbd_messaging_context(void) if (!ctx && !(ctx = messaging_init(NULL, server_id_self(), nmbd_event_context()))) { - smb_panic("Could not init nmbd messaging context\n"); + smb_panic("Could not init nmbd messaging context"); } return ctx; } diff --git a/source3/nsswitch/winbindd.c b/source3/nsswitch/winbindd.c index 94a4b7f115..c20f589434 100644 --- a/source3/nsswitch/winbindd.c +++ b/source3/nsswitch/winbindd.c @@ -39,7 +39,7 @@ struct event_context *winbind_event_context(void) static struct event_context *ctx; if (!ctx && !(ctx = event_context_init(NULL))) { - smb_panic("Could not init winbind event context\n"); + smb_panic("Could not init winbind event context"); } return ctx; } @@ -50,7 +50,7 @@ struct messaging_context *winbind_messaging_context(void) if (!ctx && !(ctx = messaging_init(NULL, server_id_self(), winbind_event_context()))) { - smb_panic("Could not init winbind messaging context\n"); + smb_panic("Could not init winbind messaging context"); } return ctx; } diff --git a/source3/nsswitch/winbindd_cm.c b/source3/nsswitch/winbindd_cm.c index cea2ff8445..c5e014192e 100644 --- a/source3/nsswitch/winbindd_cm.c +++ b/source3/nsswitch/winbindd_cm.c @@ -353,7 +353,7 @@ void set_domain_offline(struct winbindd_domain *domain) /* The above *has* to succeed for winbindd to work. */ if (!domain->check_online_event) { - smb_panic("set_domain_offline: failed to add online handler.\n"); + smb_panic("set_domain_offline: failed to add online handler"); } DEBUG(10,("set_domain_offline: added event handler for domain %s\n", @@ -496,7 +496,7 @@ void set_domain_online_request(struct winbindd_domain *domain) /* The above *has* to succeed for winbindd to work. */ if (!domain->check_online_event) { - smb_panic("set_domain_online_request: failed to add online handler.\n"); + smb_panic("set_domain_online_request: failed to add online handler"); } } diff --git a/source3/nsswitch/winbindd_util.c b/source3/nsswitch/winbindd_util.c index 082ec4440b..83d915429f 100644 --- a/source3/nsswitch/winbindd_util.c +++ b/source3/nsswitch/winbindd_util.c @@ -56,7 +56,7 @@ struct winbindd_domain *domain_list(void) /* Initialise list */ if ((!_domain_list) && (!init_domain_list())) { - smb_panic("Init_domain_list failed\n"); + smb_panic("Init_domain_list failed"); } return _domain_list; @@ -857,7 +857,7 @@ struct winbindd_domain *find_our_domain(void) return domain; } - smb_panic("Could not find our domain\n"); + smb_panic("Could not find our domain"); return NULL; } @@ -882,8 +882,9 @@ struct winbindd_domain *find_builtin_domain(void) string_to_sid(&sid, "S-1-5-32"); domain = find_domain_from_sid(&sid); - if (domain == NULL) - smb_panic("Could not find BUILTIN domain\n"); + if (domain == NULL) { + smb_panic("Could not find BUILTIN domain"); + } return domain; } diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c index 86b82174a9..26c177d5fd 100644 --- a/source3/param/loadparm.c +++ b/source3/param/loadparm.c @@ -1717,7 +1717,7 @@ TALLOC_CTX *tmp_talloc_ctx(void) } if (lp_talloc == NULL) { - smb_panic("Could not create temporary talloc context\n"); + smb_panic("Could not create temporary talloc context"); } return lp_talloc; diff --git a/source3/passdb/machine_sid.c b/source3/passdb/machine_sid.c index ebf9f2794b..998dd8ad73 100644 --- a/source3/passdb/machine_sid.c +++ b/source3/passdb/machine_sid.c @@ -186,7 +186,7 @@ DOM_SID *get_global_sam_sid(void) pdb_generate_sam_sid() as needed */ if (!(global_sam_sid = pdb_generate_sam_sid())) { - smb_panic("Could not generate a machine SID\n"); + smb_panic("could not generate a machine SID"); } return global_sam_sid; diff --git a/source3/passdb/pdb_tdb.c b/source3/passdb/pdb_tdb.c index 2cb92e542f..094479774b 100644 --- a/source3/passdb/pdb_tdb.c +++ b/source3/passdb/pdb_tdb.c @@ -1568,7 +1568,7 @@ static BOOL tdbsam_new_rid(struct pdb_methods *methods, uint32 *prid) done: if ((tdb != NULL) && (tdb_close(tdb) != 0)) { - smb_panic("tdb_close(idmap_tdb) failed\n"); + smb_panic("tdb_close(idmap_tdb) failed"); } return ret; diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 586598db89..848fdae5e0 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -66,7 +66,7 @@ TALLOC_CTX *main_loop_talloc_get(void) if (!main_loop_talloc) { main_loop_talloc = talloc_init("main loop talloc (mainly parse_misc)"); if (!main_loop_talloc) - smb_panic("main_loop_talloc: malloc fail\n"); + smb_panic("main_loop_talloc: malloc fail"); } return main_loop_talloc; @@ -452,7 +452,7 @@ void init_unistr(UNISTR *str, const char *buf) if (len) { str->buffer = TALLOC_ZERO_ARRAY(get_talloc_ctx(), uint16, len); if (str->buffer == NULL) - smb_panic("init_unistr: malloc fail\n"); + smb_panic("init_unistr: malloc fail"); rpcstr_push(str->buffer, buf, len*sizeof(uint16), STR_TERMINATE); } else { @@ -488,7 +488,7 @@ static void create_rpc_blob(RPC_DATA_BLOB *str, size_t len) if (len) { str->buffer = (uint8 *)TALLOC_ZERO(get_talloc_ctx(), len); if (str->buffer == NULL) - smb_panic("create_rpc_blob: talloc fail\n"); + smb_panic("create_rpc_blob: talloc fail"); str->buf_len = len; } else { str->buffer = NULL; @@ -595,7 +595,7 @@ void init_regval_buffer(REGVAL_BUFFER *str, const uint8 *buf, size_t len) str->buffer = (uint16 *)TALLOC_ZERO(get_talloc_ctx(), str->buf_max_len); if (str->buffer == NULL) - smb_panic("init_regval_buffer: talloc fail\n"); + smb_panic("init_regval_buffer: talloc fail"); memcpy(str->buffer, buf, str->buf_len); } } @@ -671,7 +671,7 @@ void copy_unistr2(UNISTR2 *str, const UNISTR2 *from) if (str->uni_max_len) { str->buffer = (uint16 *)TALLOC_ZERO_ARRAY(get_talloc_ctx(), uint16, str->uni_max_len); if ((str->buffer == NULL)) { - smb_panic("copy_unistr2: talloc fail\n"); + smb_panic("copy_unistr2: talloc fail"); return; } /* copy the string */ @@ -705,7 +705,7 @@ void init_string2(STRING2 *str, const char *buf, size_t max_len, size_t str_len) str->buffer = (uint8 *)TALLOC_ZERO(get_talloc_ctx(), str->str_max_len); if (str->buffer == NULL) - smb_panic("init_string2: malloc fail\n"); + smb_panic("init_string2: malloc fail"); memcpy(str->buffer, buf, str_len); } } @@ -781,7 +781,7 @@ void init_unistr2(UNISTR2 *str, const char *buf, enum unistr2_term_codes flags) str->buffer = TALLOC_ZERO_ARRAY(get_talloc_ctx(), uint16, len); if (str->buffer == NULL) { - smb_panic("init_unistr2: malloc fail\n"); + smb_panic("init_unistr2: malloc fail"); return; } @@ -817,7 +817,7 @@ void init_unistr4(UNISTR4 *uni4, const char *buf, enum unistr2_term_codes flags) { uni4->string = TALLOC_P( get_talloc_ctx(), UNISTR2 ); if (!uni4->string) { - smb_panic("init_unistr4: talloc fail\n"); + smb_panic("init_unistr4: talloc fail"); return; } init_unistr2( uni4->string, buf, flags ); @@ -830,7 +830,7 @@ void init_unistr4_w( TALLOC_CTX *ctx, UNISTR4 *uni4, const smb_ucs2_t *buf ) { uni4->string = TALLOC_P( ctx, UNISTR2 ); if (!uni4->string) { - smb_panic("init_unistr4_w: talloc fail\n"); + smb_panic("init_unistr4_w: talloc fail"); return; } init_unistr2_w( ctx, uni4->string, buf ); @@ -860,7 +860,7 @@ void init_unistr2_w(TALLOC_CTX *ctx, UNISTR2 *str, const smb_ucs2_t *buf) if (len + 1) { str->buffer = TALLOC_ZERO_ARRAY(ctx, uint16, len + 1); if (str->buffer == NULL) { - smb_panic("init_unistr2_w: talloc fail\n"); + smb_panic("init_unistr2_w: talloc fail"); return; } } else { @@ -916,7 +916,7 @@ void init_unistr2_from_unistr(UNISTR2 *to, const UNISTR *from) if (i) { to->buffer = TALLOC_ZERO_ARRAY(get_talloc_ctx(), uint16, i); if (to->buffer == NULL) - smb_panic("init_unistr2_from_unistr: malloc fail\n"); + smb_panic("init_unistr2_from_unistr: malloc fail"); memcpy(to->buffer, from->buffer, i*sizeof(uint16)); } else { to->buffer = NULL; @@ -945,7 +945,7 @@ void init_unistr2_from_datablob(UNISTR2 *str, DATA_BLOB *blob) str->buffer = NULL; } if ((str->buffer == NULL) && (blob->length > 0)) { - smb_panic("init_unistr2_from_datablob: malloc fail\n"); + smb_panic("init_unistr2_from_datablob: malloc fail"); } } @@ -1710,7 +1710,7 @@ void init_unistr3(UNISTR3 *str, const char *buf) if (str->uni_str_len) { str->str.buffer = TALLOC_ZERO_ARRAY(get_talloc_ctx(), uint16, str->uni_str_len); if (str->str.buffer == NULL) - smb_panic("init_unistr3: malloc fail\n"); + smb_panic("init_unistr3: malloc fail"); rpcstr_push((char *)str->str.buffer, buf, str->uni_str_len * sizeof(uint16), STR_TERMINATE); } else { diff --git a/source3/rpc_server/srv_lsa.c b/source3/rpc_server/srv_lsa.c index 0269e75e4e..f41cbdcc4a 100644 --- a/source3/rpc_server/srv_lsa.c +++ b/source3/rpc_server/srv_lsa.c @@ -41,7 +41,7 @@ static BOOL proxy_lsa_call(pipes_struct *p, uint8 opnum) return False; if (fns[opnum].opnum != opnum) { - smb_panic("LSA function table not sorted\n"); + smb_panic("LSA function table not sorted"); } return fns[opnum].fn(p); diff --git a/source3/smbd/blocking.c b/source3/smbd/blocking.c index 6a892b477d..924b99b113 100644 --- a/source3/smbd/blocking.c +++ b/source3/smbd/blocking.c @@ -841,13 +841,13 @@ static void process_blocking_lock_cancel_message(struct messaging_context *ctx, blocking_lock_record *blr; if (data->data == NULL) { - smb_panic("process_blocking_lock_cancel_message: null msg\n"); + smb_panic("process_blocking_lock_cancel_message: null msg"); } if (data->length != MSG_BLOCKING_LOCK_CANCEL_SIZE) { DEBUG(0, ("process_blocking_lock_cancel_message: " "Got invalid msg len %d\n", (int)data->length)); - smb_panic("process_blocking_lock_cancel_message: bad msg\n"); + smb_panic("process_blocking_lock_cancel_message: bad msg"); } memcpy(&blr, msg, sizeof(blr)); diff --git a/source3/smbd/files.c b/source3/smbd/files.c index 5ee0696ef9..590916011b 100644 --- a/source3/smbd/files.c +++ b/source3/smbd/files.c @@ -284,7 +284,7 @@ oplock_type = %u is a stat open with oplock type !\n", fsp->fsp_name, file_id_static_string(&fsp->file_id), (unsigned int)fsp->fh->gen_id, (unsigned int)fsp->oplock_type )); - smb_panic("file_find_dif\n"); + smb_panic("file_find_dif"); } return fsp; } diff --git a/source3/smbd/negprot.c b/source3/smbd/negprot.c index 92c392b366..3fdae1e06b 100644 --- a/source3/smbd/negprot.c +++ b/source3/smbd/negprot.c @@ -43,7 +43,7 @@ static void get_challenge(char buff[8]) DEBUG(10, ("get challenge: creating negprot_global_auth_context\n")); if (!NT_STATUS_IS_OK(nt_status = make_auth_context_subsystem(&negprot_global_auth_context))) { DEBUG(0, ("make_auth_context_subsystem returned %s", nt_errstr(nt_status))); - smb_panic("cannot make_negprot_global_auth_context!\n"); + smb_panic("cannot make_negprot_global_auth_context!"); } DEBUG(10, ("get challenge: getting challenge\n")); cryptkey = negprot_global_auth_context->get_ntlm_challenge(negprot_global_auth_context); diff --git a/source3/smbd/notify.c b/source3/smbd/notify.c index 5491f8eaf8..9074990be7 100644 --- a/source3/smbd/notify.c +++ b/source3/smbd/notify.c @@ -261,7 +261,7 @@ static void change_notify_remove_request(struct notify_change_request *remove_re } if (req == NULL) { - smb_panic("notify_req not found in fsp's requests\n"); + smb_panic("notify_req not found in fsp's requests"); } DLIST_REMOVE(fsp->notify->requests, req); diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c index e713922ecb..965da90a64 100644 --- a/source3/smbd/nttrans.c +++ b/source3/smbd/nttrans.c @@ -50,7 +50,7 @@ static const char *known_nt_pipes[] = { static char *nttrans_realloc(char **ptr, size_t size) { if (ptr==NULL) { - smb_panic("nttrans_realloc() called with NULL ptr\n"); + smb_panic("nttrans_realloc() called with NULL ptr"); } *ptr = (char *)SMB_REALLOC(*ptr, size); diff --git a/source3/smbd/password.c b/source3/smbd/password.c index ce03e6d85f..00f687dc27 100644 --- a/source3/smbd/password.c +++ b/source3/smbd/password.c @@ -147,7 +147,7 @@ int register_vuid(auth_serversupplied_info *server_info, /* Paranoia check. */ if(lp_security() == SEC_SHARE) { - smb_panic("Tried to register uid in security=share\n"); + smb_panic("Tried to register uid in security=share"); } /* Limit allowed vuids to 16bits - VUID_OFFSET. */ diff --git a/source3/smbd/sec_ctx.c b/source3/smbd/sec_ctx.c index 4d4e24407b..97842419d5 100644 --- a/source3/smbd/sec_ctx.c +++ b/source3/smbd/sec_ctx.c @@ -192,7 +192,7 @@ BOOL push_sec_ctx(void) if (sec_ctx_stack_ndx == MAX_SEC_CTX_DEPTH) { DEBUG(0, ("Security context stack overflow!\n")); - smb_panic("Security context stack overflow!\n"); + smb_panic("Security context stack overflow!"); } /* Store previous user context */ @@ -374,7 +374,7 @@ BOOL pop_sec_ctx(void) if (sec_ctx_stack_ndx == 0) { DEBUG(0, ("Security context stack underflow!\n")); - smb_panic("Security context stack underflow!\n"); + smb_panic("Security context stack underflow!"); } ctx_p = &sec_ctx_stack[sec_ctx_stack_ndx]; diff --git a/source3/smbd/server.c b/source3/smbd/server.c index 532de36bf8..edbd879847 100644 --- a/source3/smbd/server.c +++ b/source3/smbd/server.c @@ -67,7 +67,7 @@ struct event_context *smbd_event_context(void) static struct event_context *ctx; if (!ctx && !(ctx = event_context_init(NULL))) { - smb_panic("Could not init smbd event context\n"); + smb_panic("Could not init smbd event context"); } return ctx; } @@ -78,7 +78,7 @@ struct messaging_context *smbd_messaging_context(void) if (!ctx && !(ctx = messaging_init(NULL, server_id_self(), smbd_event_context()))) { - smb_panic("Could not init smbd messaging context\n"); + smb_panic("Could not init smbd messaging context"); } return ctx; } @@ -539,7 +539,7 @@ static BOOL open_sockets_smbd(enum smb_server_mode server_mode, const char *smb_ * CLEAR_IF_FIRST flags */ if (tdb_reopen_all(1) == -1) { DEBUG(0,("tdb_reopen_all failed.\n")); - smb_panic("tdb_reopen_all failed."); + smb_panic("tdb_reopen_all failed"); } return True; diff --git a/source3/smbd/share_access.c b/source3/smbd/share_access.c index adb9d16964..b12d543f5a 100644 --- a/source3/smbd/share_access.c +++ b/source3/smbd/share_access.c @@ -86,7 +86,7 @@ static BOOL token_contains_name(TALLOC_CTX *mem_ctx, if (name == NULL) { /* This is too security sensitive, better panic than return a * result that might be interpreted in a wrong way. */ - smb_panic("substitutions failed\n"); + smb_panic("substitutions failed"); } /* check to see is we already have a SID */ @@ -136,7 +136,7 @@ static BOOL token_contains_name(TALLOC_CTX *mem_ctx, } continue; } - smb_panic("got invalid prefix from do_groups_check\n"); + smb_panic("got invalid prefix from do_groups_check"); } return False; } @@ -164,7 +164,7 @@ BOOL token_contains_name_in_list(const char *username, } if ( (mem_ctx = talloc_new(NULL)) == NULL ) { - smb_panic("talloc_new failed\n"); + smb_panic("talloc_new failed"); } while (*list != NULL) { diff --git a/source3/tests/summary.c b/source3/tests/summary.c index 735f93e116..c3da22f170 100644 --- a/source3/tests/summary.c +++ b/source3/tests/summary.c @@ -3,6 +3,7 @@ main() { + exit (0); #if !(defined(HAVE_FCNTL_LOCK) || defined(HAVE_STRUCT_FLOCK64)) printf("ERROR: No locking available. Running Samba would be unsafe\n"); exit(1); |