From 4b01e378d2a1a7e5e93573878fcdc05907e9a5bd Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Thu, 24 Sep 2009 18:20:13 +0200 Subject: s3: remove unused printing macros. Guenther --- source3/include/ntdomain.h | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/source3/include/ntdomain.h b/source3/include/ntdomain.h index f90478296c..bbe653b8bd 100644 --- a/source3/include/ntdomain.h +++ b/source3/include/ntdomain.h @@ -241,15 +241,4 @@ struct api_struct { bool (*fn) (pipes_struct *); }; -/* - * higher order functions for use with msrpc client code - */ - -#define PRINT_INFO_FN(fn)\ - void (*fn)(const char*, uint32, uint32, void *const *const) -#define JOB_INFO_FN(fn)\ - void (*fn)(const char*, const char*, uint32, uint32, void *const *const) - -/* end higher order functions */ - #endif /* _NT_DOMAIN_H */ -- cgit From c789d041f0e7946a3c07a5ed8d70e5cb462d1773 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Thu, 24 Sep 2009 18:20:50 +0200 Subject: s3-winbindd: no reason to call winbindd_can_contact_domain() three times in query_user(). Guenther --- source3/winbindd/winbindd_rpc.c | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/source3/winbindd/winbindd_rpc.c b/source3/winbindd/winbindd_rpc.c index 82e782b9db..ac5c3d2d93 100644 --- a/source3/winbindd/winbindd_rpc.c +++ b/source3/winbindd/winbindd_rpc.c @@ -493,18 +493,6 @@ static NTSTATUS query_user(struct winbindd_domain *domain, return NT_STATUS_OK; } - if ( !winbindd_can_contact_domain( domain ) ) { - DEBUG(10,("query_user: No incoming trust for domain %s\n", - domain->name)); - return NT_STATUS_OK; - } - - if ( !winbindd_can_contact_domain( domain ) ) { - DEBUG(10,("query_user: No incoming trust for domain %s\n", - domain->name)); - return NT_STATUS_OK; - } - /* no cache; hit the wire */ result = cm_connect_sam(domain, mem_ctx, &cli, &dom_pol); -- cgit From 506b0b6435ee86d58b4f92b91f1f2b0c498da3fd Mon Sep 17 00:00:00 2001 From: Matthias Dieter Wallnöfer Date: Thu, 24 Sep 2009 23:49:41 +0200 Subject: s3:vfs_default - correct function parameters --- source3/modules/vfs_default.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c index 408721ab3e..c92bc8ec21 100644 --- a/source3/modules/vfs_default.c +++ b/source3/modules/vfs_default.c @@ -652,7 +652,8 @@ static int vfswrap_lstat(vfs_handle_struct *handle, } static NTSTATUS vfswrap_translate_name(vfs_handle_struct *handle, - char **mapped_name) + char **mapped_name, + enum vfs_translate_direction direction) { /* Default behavior is a NOOP */ -- cgit From 918b5a7e057bd91289ec06b3ef8d95da43a50ede Mon Sep 17 00:00:00 2001 From: Matthias Dieter Wallnöfer Date: Thu, 24 Sep 2009 23:50:05 +0200 Subject: s3:util_str "str_list_make_v3" - introduce also here the "const" result I did this to match with the default util strlist library. --- source3/include/proto.h | 2 +- source3/lib/util_str.c | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/source3/include/proto.h b/source3/include/proto.h index d664a26949..e17486b7fc 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -1563,7 +1563,7 @@ bool validate_net_name( const char *name, const char *invalid_chars, int max_len); char *escape_shell_string(const char *src); -char **str_list_make_v3(TALLOC_CTX *mem_ctx, const char *string, const char *sep); +const char **str_list_make_v3(TALLOC_CTX *mem_ctx, const char *string, const char *sep); /* The following definitions come from lib/util_unistr.c */ diff --git a/source3/lib/util_str.c b/source3/lib/util_str.c index c197fd7515..2136388eb4 100644 --- a/source3/lib/util_str.c +++ b/source3/lib/util_str.c @@ -1616,7 +1616,7 @@ bool str_list_sub_basic( char **list, const char *smb_name, } /****************************************************************************** - substritute a specific pattern in a string list + substitute a specific pattern in a string list *****************************************************************************/ bool str_list_substitute(char **list, const char *pattern, const char *insert) @@ -2430,18 +2430,18 @@ char *escape_shell_string(const char *src) #define S_LIST_ABS 16 /* List Allocation Block Size */ -char **str_list_make_v3(TALLOC_CTX *mem_ctx, const char *string, const char *sep) +const char **str_list_make_v3(TALLOC_CTX *mem_ctx, const char *string, + const char *sep) { - char **list; + const char **list; const char *str; - char *s; + char *s, *tok; int num, lsize; - char *tok; if (!string || !*string) return NULL; - list = TALLOC_ARRAY(mem_ctx, char *, S_LIST_ABS+1); + list = TALLOC_ARRAY(mem_ctx, const char *, S_LIST_ABS+1); if (list == NULL) { return NULL; } @@ -2461,11 +2461,11 @@ char **str_list_make_v3(TALLOC_CTX *mem_ctx, const char *string, const char *sep while (next_token_talloc(list, &str, &tok, sep)) { if (num == lsize) { - char **tmp; + const char **tmp; lsize += S_LIST_ABS; - tmp = TALLOC_REALLOC_ARRAY(mem_ctx, list, char *, + tmp = TALLOC_REALLOC_ARRAY(mem_ctx, list, const char *, lsize + 1); if (tmp == NULL) { DEBUG(0,("str_list_make: " @@ -2477,7 +2477,7 @@ char **str_list_make_v3(TALLOC_CTX *mem_ctx, const char *string, const char *sep list = tmp; memset (&list[num], 0, - ((sizeof(char**)) * (S_LIST_ABS +1))); + ((sizeof(const char**)) * (S_LIST_ABS +1))); } list[num] = tok; -- cgit From b39c390280d1f268e2550c731057aec550a3f086 Mon Sep 17 00:00:00 2001 From: Matthias Dieter Wallnöfer Date: Thu, 24 Sep 2009 23:52:19 +0200 Subject: s3: Fix up various string "const" warnings My changed introduced some warnings. Fix them. --- source3/auth/auth.c | 18 +++++++++--------- source3/param/loadparm.c | 6 +++--- source3/smbd/map_username.c | 2 +- source3/smbd/password.c | 24 ++++++++++++------------ 4 files changed, 25 insertions(+), 25 deletions(-) diff --git a/source3/auth/auth.c b/source3/auth/auth.c index ce8722a1b4..b445987ee2 100644 --- a/source3/auth/auth.c +++ b/source3/auth/auth.c @@ -455,7 +455,7 @@ NTSTATUS make_auth_context_subsystem(struct auth_context **auth_context) NTSTATUS nt_status; if (lp_auth_methods() - && !(auth_method_list = str_list_copy(talloc_tos(), + && !(auth_method_list = (char **) str_list_copy(talloc_tos(), lp_auth_methods()))) { return NT_STATUS_NO_MEMORY; } @@ -465,13 +465,13 @@ NTSTATUS make_auth_context_subsystem(struct auth_context **auth_context) { case SEC_DOMAIN: DEBUG(5,("Making default auth method list for security=domain\n")); - auth_method_list = str_list_make_v3( + auth_method_list = (char **) str_list_make_v3( talloc_tos(), "guest sam winbind:ntdomain", NULL); break; case SEC_SERVER: DEBUG(5,("Making default auth method list for security=server\n")); - auth_method_list = str_list_make_v3( + auth_method_list = (char **) str_list_make_v3( talloc_tos(), "guest sam smbserver", NULL); break; @@ -479,36 +479,36 @@ NTSTATUS make_auth_context_subsystem(struct auth_context **auth_context) if (lp_encrypted_passwords()) { if ((lp_server_role() == ROLE_DOMAIN_PDC) || (lp_server_role() == ROLE_DOMAIN_BDC)) { DEBUG(5,("Making default auth method list for DC, security=user, encrypt passwords = yes\n")); - auth_method_list = str_list_make_v3( + auth_method_list = (char **) str_list_make_v3( talloc_tos(), "guest sam winbind:trustdomain", NULL); } else { DEBUG(5,("Making default auth method list for standalone security=user, encrypt passwords = yes\n")); - auth_method_list = str_list_make_v3( + auth_method_list = (char **) str_list_make_v3( talloc_tos(), "guest sam", NULL); } } else { DEBUG(5,("Making default auth method list for security=user, encrypt passwords = no\n")); - auth_method_list = str_list_make_v3( + auth_method_list = (char **) str_list_make_v3( talloc_tos(), "guest unix", NULL); } break; case SEC_SHARE: if (lp_encrypted_passwords()) { DEBUG(5,("Making default auth method list for security=share, encrypt passwords = yes\n")); - auth_method_list = str_list_make_v3( + auth_method_list = (char **) str_list_make_v3( talloc_tos(), "guest sam", NULL); } else { DEBUG(5,("Making default auth method list for security=share, encrypt passwords = no\n")); - auth_method_list = str_list_make_v3( + auth_method_list = (char **) str_list_make_v3( talloc_tos(), "guest unix", NULL); } break; case SEC_ADS: DEBUG(5,("Making default auth method list for security=ADS\n")); - auth_method_list = str_list_make_v3( + auth_method_list = (char **) str_list_make_v3( talloc_tos(), "guest sam winbind:ntdomain", NULL); break; diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c index b278b9616d..c93787e638 100644 --- a/source3/param/loadparm.c +++ b/source3/param/loadparm.c @@ -6745,7 +6745,7 @@ static void copy_service(struct service *pserviceDest, struct service *pserviceS break; case P_LIST: TALLOC_FREE(*((char ***)dest_ptr)); - *((char ***)dest_ptr) = str_list_copy(NULL, + *((const char ***)dest_ptr) = str_list_copy(NULL, *(const char ***)src_ptr); break; default: @@ -8218,8 +8218,8 @@ static void lp_save_defaults(void) continue; switch (parm_table[i].type) { case P_LIST: - parm_table[i].def.lvalue = str_list_copy( - NULL, *(const char ***)parm_table[i].ptr); + parm_table[i].def.lvalue = (char **) + str_list_copy(NULL, *(const char ***)parm_table[i].ptr); break; case P_STRING: case P_USTRING: diff --git a/source3/smbd/map_username.c b/source3/smbd/map_username.c index 24b4ddd271..e9ef74cf25 100644 --- a/source3/smbd/map_username.c +++ b/source3/smbd/map_username.c @@ -146,7 +146,7 @@ bool map_username(struct smbd_server_connection *sconn, fstring user) while((s=fgets_slash(buf,sizeof(buf),f))!=NULL) { char *unixname = s; char *dosname = strchr_m(unixname,'='); - char **dosuserlist; + const char **dosuserlist; bool return_if_mapped = False; if (!dosname) diff --git a/source3/smbd/password.c b/source3/smbd/password.c index 4c1cef45cc..d6a84470e1 100644 --- a/source3/smbd/password.c +++ b/source3/smbd/password.c @@ -551,14 +551,13 @@ bool user_in_list(struct smbd_server_connection *sconn, static bool user_ok(struct smbd_server_connection *sconn, const char *user, int snum) { - char **valid, **invalid; bool ret; - valid = invalid = NULL; ret = True; if (lp_invalid_users(snum)) { - invalid = str_list_copy(talloc_tos(), lp_invalid_users(snum)); + char **invalid = (char **) str_list_copy(talloc_tos(), + lp_invalid_users(snum)); if (invalid && str_list_substitute(invalid, "%S", lp_servicename(snum))) { @@ -567,36 +566,37 @@ static bool user_ok(struct smbd_server_connection *sconn, if ( invalid && str_list_sub_basic(invalid, "", "") ) { ret = !user_in_list(sconn, user, - (const char **)invalid); + (const char **)invalid); } } + TALLOC_FREE(invalid); } - TALLOC_FREE(invalid); if (ret && lp_valid_users(snum)) { - valid = str_list_copy(talloc_tos(), lp_valid_users(snum)); - if ( valid && - str_list_substitute(valid, "%S", lp_servicename(snum)) ) { + char **valid = (char **) str_list_copy(talloc_tos(), + lp_valid_users(snum)); + if (valid && + str_list_substitute(valid, "%S", lp_servicename(snum))) { /* This is used in sec=share only, so no current user * around to pass to str_list_sub_basic() */ if ( valid && str_list_sub_basic(valid, "", "") ) { ret = user_in_list(sconn, user, - (const char **)valid); + (const char **)valid); } } + TALLOC_FREE(valid); } - TALLOC_FREE(valid); if (ret && lp_onlyuser(snum)) { - char **user_list = str_list_make_v3( + char **user_list = (char **) str_list_make_v3( talloc_tos(), lp_username(snum), NULL); if (user_list && str_list_substitute(user_list, "%S", lp_servicename(snum))) { ret = user_in_list(sconn, user, - (const char **)user_list); + (const char **)user_list); } TALLOC_FREE(user_list); } -- cgit From 4f10aa59730b44fc4328daca3e2e43693fc1b69f Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 24 Sep 2009 15:42:36 -0700 Subject: Revert 918b5a7e057bd91289ec06b3ef8d95da43a50ede. This code should *not* return const. Jeremy. --- source3/lib/util_str.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/source3/lib/util_str.c b/source3/lib/util_str.c index 2136388eb4..9a0b12adea 100644 --- a/source3/lib/util_str.c +++ b/source3/lib/util_str.c @@ -2430,10 +2430,10 @@ char *escape_shell_string(const char *src) #define S_LIST_ABS 16 /* List Allocation Block Size */ -const char **str_list_make_v3(TALLOC_CTX *mem_ctx, const char *string, +char **str_list_make_v3(TALLOC_CTX *mem_ctx, const char *string, const char *sep) { - const char **list; + char **list; const char *str; char *s, *tok; int num, lsize; @@ -2441,7 +2441,7 @@ const char **str_list_make_v3(TALLOC_CTX *mem_ctx, const char *string, if (!string || !*string) return NULL; - list = TALLOC_ARRAY(mem_ctx, const char *, S_LIST_ABS+1); + list = TALLOC_ARRAY(mem_ctx, char *, S_LIST_ABS+1); if (list == NULL) { return NULL; } @@ -2461,11 +2461,11 @@ const char **str_list_make_v3(TALLOC_CTX *mem_ctx, const char *string, while (next_token_talloc(list, &str, &tok, sep)) { if (num == lsize) { - const char **tmp; + char **tmp; lsize += S_LIST_ABS; - tmp = TALLOC_REALLOC_ARRAY(mem_ctx, list, const char *, + tmp = TALLOC_REALLOC_ARRAY(mem_ctx, list, char *, lsize + 1); if (tmp == NULL) { DEBUG(0,("str_list_make: " @@ -2477,7 +2477,7 @@ const char **str_list_make_v3(TALLOC_CTX *mem_ctx, const char *string, list = tmp; memset (&list[num], 0, - ((sizeof(const char**)) * (S_LIST_ABS +1))); + ((sizeof(char**)) * (S_LIST_ABS +1))); } list[num] = tok; -- cgit From 536c4dd2d69f9a35547c0ce77b47c4f0b03aa5ac Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 24 Sep 2009 15:44:28 -0700 Subject: Revert b39c390280d1f268e2550c731057aec550a3f086 - casts should not be here. Jeremy. --- source3/auth/auth.c | 18 +++++++++--------- source3/include/proto.h | 2 +- source3/param/loadparm.c | 6 +++--- source3/smbd/map_username.c | 2 +- source3/smbd/password.c | 24 ++++++++++++------------ 5 files changed, 26 insertions(+), 26 deletions(-) diff --git a/source3/auth/auth.c b/source3/auth/auth.c index b445987ee2..ce8722a1b4 100644 --- a/source3/auth/auth.c +++ b/source3/auth/auth.c @@ -455,7 +455,7 @@ NTSTATUS make_auth_context_subsystem(struct auth_context **auth_context) NTSTATUS nt_status; if (lp_auth_methods() - && !(auth_method_list = (char **) str_list_copy(talloc_tos(), + && !(auth_method_list = str_list_copy(talloc_tos(), lp_auth_methods()))) { return NT_STATUS_NO_MEMORY; } @@ -465,13 +465,13 @@ NTSTATUS make_auth_context_subsystem(struct auth_context **auth_context) { case SEC_DOMAIN: DEBUG(5,("Making default auth method list for security=domain\n")); - auth_method_list = (char **) str_list_make_v3( + auth_method_list = str_list_make_v3( talloc_tos(), "guest sam winbind:ntdomain", NULL); break; case SEC_SERVER: DEBUG(5,("Making default auth method list for security=server\n")); - auth_method_list = (char **) str_list_make_v3( + auth_method_list = str_list_make_v3( talloc_tos(), "guest sam smbserver", NULL); break; @@ -479,36 +479,36 @@ NTSTATUS make_auth_context_subsystem(struct auth_context **auth_context) if (lp_encrypted_passwords()) { if ((lp_server_role() == ROLE_DOMAIN_PDC) || (lp_server_role() == ROLE_DOMAIN_BDC)) { DEBUG(5,("Making default auth method list for DC, security=user, encrypt passwords = yes\n")); - auth_method_list = (char **) str_list_make_v3( + auth_method_list = str_list_make_v3( talloc_tos(), "guest sam winbind:trustdomain", NULL); } else { DEBUG(5,("Making default auth method list for standalone security=user, encrypt passwords = yes\n")); - auth_method_list = (char **) str_list_make_v3( + auth_method_list = str_list_make_v3( talloc_tos(), "guest sam", NULL); } } else { DEBUG(5,("Making default auth method list for security=user, encrypt passwords = no\n")); - auth_method_list = (char **) str_list_make_v3( + auth_method_list = str_list_make_v3( talloc_tos(), "guest unix", NULL); } break; case SEC_SHARE: if (lp_encrypted_passwords()) { DEBUG(5,("Making default auth method list for security=share, encrypt passwords = yes\n")); - auth_method_list = (char **) str_list_make_v3( + auth_method_list = str_list_make_v3( talloc_tos(), "guest sam", NULL); } else { DEBUG(5,("Making default auth method list for security=share, encrypt passwords = no\n")); - auth_method_list = (char **) str_list_make_v3( + auth_method_list = str_list_make_v3( talloc_tos(), "guest unix", NULL); } break; case SEC_ADS: DEBUG(5,("Making default auth method list for security=ADS\n")); - auth_method_list = (char **) str_list_make_v3( + auth_method_list = str_list_make_v3( talloc_tos(), "guest sam winbind:ntdomain", NULL); break; diff --git a/source3/include/proto.h b/source3/include/proto.h index e17486b7fc..d664a26949 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -1563,7 +1563,7 @@ bool validate_net_name( const char *name, const char *invalid_chars, int max_len); char *escape_shell_string(const char *src); -const char **str_list_make_v3(TALLOC_CTX *mem_ctx, const char *string, const char *sep); +char **str_list_make_v3(TALLOC_CTX *mem_ctx, const char *string, const char *sep); /* The following definitions come from lib/util_unistr.c */ diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c index c93787e638..b278b9616d 100644 --- a/source3/param/loadparm.c +++ b/source3/param/loadparm.c @@ -6745,7 +6745,7 @@ static void copy_service(struct service *pserviceDest, struct service *pserviceS break; case P_LIST: TALLOC_FREE(*((char ***)dest_ptr)); - *((const char ***)dest_ptr) = str_list_copy(NULL, + *((char ***)dest_ptr) = str_list_copy(NULL, *(const char ***)src_ptr); break; default: @@ -8218,8 +8218,8 @@ static void lp_save_defaults(void) continue; switch (parm_table[i].type) { case P_LIST: - parm_table[i].def.lvalue = (char **) - str_list_copy(NULL, *(const char ***)parm_table[i].ptr); + parm_table[i].def.lvalue = str_list_copy( + NULL, *(const char ***)parm_table[i].ptr); break; case P_STRING: case P_USTRING: diff --git a/source3/smbd/map_username.c b/source3/smbd/map_username.c index e9ef74cf25..24b4ddd271 100644 --- a/source3/smbd/map_username.c +++ b/source3/smbd/map_username.c @@ -146,7 +146,7 @@ bool map_username(struct smbd_server_connection *sconn, fstring user) while((s=fgets_slash(buf,sizeof(buf),f))!=NULL) { char *unixname = s; char *dosname = strchr_m(unixname,'='); - const char **dosuserlist; + char **dosuserlist; bool return_if_mapped = False; if (!dosname) diff --git a/source3/smbd/password.c b/source3/smbd/password.c index d6a84470e1..4c1cef45cc 100644 --- a/source3/smbd/password.c +++ b/source3/smbd/password.c @@ -551,13 +551,14 @@ bool user_in_list(struct smbd_server_connection *sconn, static bool user_ok(struct smbd_server_connection *sconn, const char *user, int snum) { + char **valid, **invalid; bool ret; + valid = invalid = NULL; ret = True; if (lp_invalid_users(snum)) { - char **invalid = (char **) str_list_copy(talloc_tos(), - lp_invalid_users(snum)); + invalid = str_list_copy(talloc_tos(), lp_invalid_users(snum)); if (invalid && str_list_substitute(invalid, "%S", lp_servicename(snum))) { @@ -566,37 +567,36 @@ static bool user_ok(struct smbd_server_connection *sconn, if ( invalid && str_list_sub_basic(invalid, "", "") ) { ret = !user_in_list(sconn, user, - (const char **)invalid); + (const char **)invalid); } } - TALLOC_FREE(invalid); } + TALLOC_FREE(invalid); if (ret && lp_valid_users(snum)) { - char **valid = (char **) str_list_copy(talloc_tos(), - lp_valid_users(snum)); - if (valid && - str_list_substitute(valid, "%S", lp_servicename(snum))) { + valid = str_list_copy(talloc_tos(), lp_valid_users(snum)); + if ( valid && + str_list_substitute(valid, "%S", lp_servicename(snum)) ) { /* This is used in sec=share only, so no current user * around to pass to str_list_sub_basic() */ if ( valid && str_list_sub_basic(valid, "", "") ) { ret = user_in_list(sconn, user, - (const char **)valid); + (const char **)valid); } } - TALLOC_FREE(valid); } + TALLOC_FREE(valid); if (ret && lp_onlyuser(snum)) { - char **user_list = (char **) str_list_make_v3( + char **user_list = str_list_make_v3( talloc_tos(), lp_username(snum), NULL); if (user_list && str_list_substitute(user_list, "%S", lp_servicename(snum))) { ret = user_in_list(sconn, user, - (const char **)user_list); + (const char **)user_list); } TALLOC_FREE(user_list); } -- cgit From d1aa7d479697a8fcc5d8237271c473a1b831949b Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 24 Sep 2009 15:52:58 -0700 Subject: Remove the const from the str_list_XXX functions that allocate both list and containing strings. This fixes problems that people have tried to cast away and are not needed. Jeremy. --- lib/util/util.h | 10 +++++----- lib/util/util_strlist.c | 38 +++++++++++++++++++------------------- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/lib/util/util.h b/lib/util/util.h index 385a3ae07a..c766e3dce7 100644 --- a/lib/util/util.h +++ b/lib/util/util.h @@ -407,12 +407,12 @@ _PUBLIC_ bool strequal(const char *s1, const char *s2); /** build an empty (only NULL terminated) list of strings (for expansion with str_list_add() etc) */ -_PUBLIC_ const char **str_list_make_empty(TALLOC_CTX *mem_ctx); +_PUBLIC_ char **str_list_make_empty(TALLOC_CTX *mem_ctx); /** place the only element 'entry' into a new, NULL terminated string list */ -_PUBLIC_ const char **str_list_make_single(TALLOC_CTX *mem_ctx, +_PUBLIC_ char **str_list_make_single(TALLOC_CTX *mem_ctx, const char *entry); /** @@ -420,7 +420,7 @@ _PUBLIC_ const char **str_list_make_single(TALLOC_CTX *mem_ctx, separator list. The separator list must contain characters less than or equal to 0x2f for this to work correctly on multi-byte strings */ -_PUBLIC_ const char **str_list_make(TALLOC_CTX *mem_ctx, const char *string, +_PUBLIC_ char **str_list_make(TALLOC_CTX *mem_ctx, const char *string, const char *sep); /** @@ -428,7 +428,7 @@ _PUBLIC_ const char **str_list_make(TALLOC_CTX *mem_ctx, const char *string, * Entries are seperated by spaces and can be enclosed by quotes. * Does NOT support escaping */ -_PUBLIC_ const char **str_list_make_shell(TALLOC_CTX *mem_ctx, const char *string, const char *sep); +_PUBLIC_ char **str_list_make_shell(TALLOC_CTX *mem_ctx, const char *string, const char *sep); /** * join a list back to one string @@ -447,7 +447,7 @@ _PUBLIC_ size_t str_list_length(const char * const *list); /** copy a string list */ -_PUBLIC_ const char **str_list_copy(TALLOC_CTX *mem_ctx, const char **list); +_PUBLIC_ char **str_list_copy(TALLOC_CTX *mem_ctx, const char **list); /** Return true if all the elements of the list match exactly. diff --git a/lib/util/util_strlist.c b/lib/util/util_strlist.c index b4b991f3db..1331fee6a7 100644 --- a/lib/util/util_strlist.c +++ b/lib/util/util_strlist.c @@ -31,11 +31,11 @@ /** build an empty (only NULL terminated) list of strings (for expansion with str_list_add() etc) */ -_PUBLIC_ const char **str_list_make_empty(TALLOC_CTX *mem_ctx) +_PUBLIC_ char **str_list_make_empty(TALLOC_CTX *mem_ctx) { - const char **ret = NULL; + char **ret = NULL; - ret = talloc_array(mem_ctx, const char *, 1); + ret = talloc_array(mem_ctx, char *, 1); if (ret == NULL) { return NULL; } @@ -48,11 +48,11 @@ _PUBLIC_ const char **str_list_make_empty(TALLOC_CTX *mem_ctx) /** place the only element 'entry' into a new, NULL terminated string list */ -_PUBLIC_ const char **str_list_make_single(TALLOC_CTX *mem_ctx, const char *entry) +_PUBLIC_ char **str_list_make_single(TALLOC_CTX *mem_ctx, const char *entry) { - const char **ret = NULL; + char **ret = NULL; - ret = talloc_array(mem_ctx, const char *, 2); + ret = talloc_array(mem_ctx, char *, 2); if (ret == NULL) { return NULL; } @@ -72,30 +72,30 @@ _PUBLIC_ const char **str_list_make_single(TALLOC_CTX *mem_ctx, const char *entr separator list. The separator list must contain characters less than or equal to 0x2f for this to work correctly on multi-byte strings */ -_PUBLIC_ const char **str_list_make(TALLOC_CTX *mem_ctx, const char *string, const char *sep) +_PUBLIC_ char **str_list_make(TALLOC_CTX *mem_ctx, const char *string, const char *sep) { int num_elements = 0; - const char **ret = NULL; + char **ret = NULL; if (sep == NULL) { sep = LIST_SEP; } - ret = talloc_array(mem_ctx, const char *, 1); + ret = talloc_array(mem_ctx, char *, 1); if (ret == NULL) { return NULL; } while (string && *string) { size_t len = strcspn(string, sep); - const char **ret2; + char **ret2; if (len == 0) { string += strspn(string, sep); continue; } - ret2 = talloc_realloc(mem_ctx, ret, const char *, + ret2 = talloc_realloc(mem_ctx, ret, char *, num_elements+2); if (ret2 == NULL) { talloc_free(ret); @@ -123,12 +123,12 @@ _PUBLIC_ const char **str_list_make(TALLOC_CTX *mem_ctx, const char *string, con * Entries are seperated by spaces and can be enclosed by quotes. * Does NOT support escaping */ -_PUBLIC_ const char **str_list_make_shell(TALLOC_CTX *mem_ctx, const char *string, const char *sep) +_PUBLIC_ char **str_list_make_shell(TALLOC_CTX *mem_ctx, const char *string, const char *sep) { int num_elements = 0; - const char **ret = NULL; + char **ret = NULL; - ret = talloc_array(mem_ctx, const char *, 1); + ret = talloc_array(mem_ctx, char *, 1); if (ret == NULL) { return NULL; } @@ -139,7 +139,7 @@ _PUBLIC_ const char **str_list_make_shell(TALLOC_CTX *mem_ctx, const char *strin while (string && *string) { size_t len = strcspn(string, sep); char *element; - const char **ret2; + char **ret2; if (len == 0) { string += strspn(string, sep); @@ -161,7 +161,7 @@ _PUBLIC_ const char **str_list_make_shell(TALLOC_CTX *mem_ctx, const char *strin return NULL; } - ret2 = talloc_realloc(mem_ctx, ret, const char *, num_elements+2); + ret2 = talloc_realloc(mem_ctx, ret, char *, num_elements+2); if (ret2 == NULL) { talloc_free(ret); return NULL; @@ -238,15 +238,15 @@ _PUBLIC_ size_t str_list_length(const char * const *list) /** copy a string list */ -_PUBLIC_ const char **str_list_copy(TALLOC_CTX *mem_ctx, const char **list) +_PUBLIC_ char **str_list_copy(TALLOC_CTX *mem_ctx, const char **list) { int i; - const char **ret; + char **ret; if (list == NULL) return NULL; - ret = talloc_array(mem_ctx, const char *, str_list_length(list)+1); + ret = talloc_array(mem_ctx, char *, str_list_length(list)+1); if (ret == NULL) return NULL; -- cgit From fe0387f047b21b56d452eaf4f13a6b773c4dbe08 Mon Sep 17 00:00:00 2001 From: John H Terpstra Date: Thu, 24 Sep 2009 19:18:33 -0500 Subject: Bug fix thanks to vjbangis viray --- docs-xml/Samba3-ByExample/SBE-TheSmallOffice.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs-xml/Samba3-ByExample/SBE-TheSmallOffice.xml b/docs-xml/Samba3-ByExample/SBE-TheSmallOffice.xml index 846145ed58..625cfed219 100644 --- a/docs-xml/Samba3-ByExample/SBE-TheSmallOffice.xml +++ b/docs-xml/Samba3-ByExample/SBE-TheSmallOffice.xml @@ -489,8 +489,8 @@ Users (S-1-5-32-545) -> -1 &rootprompt; mkdir -p /data/{accounts,finsvcs} &rootprompt; chown -R root:root /data -&rootprompt; chown -R alanm:accounts /data/accounts -&rootprompt; chown -R alanm:finsvcs /data/finsvcs +&rootprompt; chown -R alanm:acctsdep /data/accounts +&rootprompt; chown -R alanm:finsrvcs /data/finsrvcs &rootprompt; chmod -R ug+rwx,o+rx-w /data Each department is responsible for creating its own directory structure within its @@ -688,9 +688,9 @@ hosts: files wins %G No - + Financial Service Files -/data/finsvcs +/data/finsrvcs %G No -- cgit From 8a90106beb6344b94d159efd997d07d27a27f9b4 Mon Sep 17 00:00:00 2001 From: John H Terpstra Date: Thu, 24 Sep 2009 19:26:03 -0500 Subject: Patches to fix typos thanks to OPC oota. --- docs-xml/Samba3-HOWTO/TOSHARG-IDMAP.xml | 4 ++-- docs-xml/Samba3-HOWTO/TOSHARG-TheNetCommand.xml | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs-xml/Samba3-HOWTO/TOSHARG-IDMAP.xml b/docs-xml/Samba3-HOWTO/TOSHARG-IDMAP.xml index 4781994881..f590334ebe 100644 --- a/docs-xml/Samba3-HOWTO/TOSHARG-IDMAP.xml +++ b/docs-xml/Samba3-HOWTO/TOSHARG-IDMAP.xml @@ -36,7 +36,7 @@ This is followed by an overview of how the IDMAP facility may be implemented. The IDMAP facility is of concern where more than one Samba server (or Samba network client) is installed in a domain. Where there is a single Samba server, do not be too concerned regarding the IDMAP infrastructure &smbmdash; the default behavior of Samba is nearly always sufficient. -Where mulitple Samba servers are used it is often necessary to move data off one server and onto +Where multiple Samba servers are used it is often necessary to move data off one server and onto another, and that is where the fun begins! @@ -426,7 +426,7 @@ on Server Types and Security Modes. passdb backend BDC LDAP backend - Security identifiers used within a domain must be managed to avoid conflict and to preserve itegrity. + Security identifiers used within a domain must be managed to avoid conflict and to preserve integrity. In an NT4 domain context, the PDC manages the distribution of all security credentials to the backup domain controllers (BDCs). At this time the only passdb backend for a Samba domain controller that is suitable for such information is an LDAP backend. diff --git a/docs-xml/Samba3-HOWTO/TOSHARG-TheNetCommand.xml b/docs-xml/Samba3-HOWTO/TOSHARG-TheNetCommand.xml index ea0ed485c0..6e96ad1e1a 100644 --- a/docs-xml/Samba3-HOWTO/TOSHARG-TheNetCommand.xml +++ b/docs-xml/Samba3-HOWTO/TOSHARG-TheNetCommand.xml @@ -634,7 +634,7 @@ exit 0 Modify the &smb.conf; file so the NETLOGON stanza contains the parameters - shown in the Netlogon Example smb.conf file. + shown in the Netlogon Example smb.conf file as shown. @@ -1303,7 +1303,7 @@ Storing SID S-1-5-21-726309263-4128913605-1168186429 \ that the addition and deletion of shares using this tool depends on the availability of a suitable interface script. The interface scripts Sambas smbd uses are called , and - A set of example scripts are provided in the Samba source + . A set of example scripts are provided in the Samba source code tarball in the directory ~samba/examples/scripts. @@ -1630,7 +1630,7 @@ net rpc share MIGRATE ALL <share-name> -S <source> Printing needs vary greatly depending on the network environment and may be very simple or complex. If the need is very simple, the best solution to the implementation of printing support may well be to re-install everything from a clean slate instead of migrating older configurations. On the other hand, - a complex network that is integrated with many international offices and a multiplexity of local branch + a complex network that is integrated with many international offices and a complex arrangement of local branch offices, each of which form an inter-twined maze of printing possibilities, the ability to migrate all printer configurations is decidedly beneficial. To manually re-establish a complex printing network will take much time and frustration. Often it will not be possible to find driver files that are -- cgit From 1e4868d251a4546c92ec275e37e9c5e11f30d1b8 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 24 Sep 2009 17:44:45 -0700 Subject: Reduce debug log level from 0 -> 7 on non-critical message. Jeremy. --- source3/nmbd/nmbd_packets.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source3/nmbd/nmbd_packets.c b/source3/nmbd/nmbd_packets.c index 4045184f33..6136c6d171 100644 --- a/source3/nmbd/nmbd_packets.c +++ b/source3/nmbd/nmbd_packets.c @@ -1068,7 +1068,7 @@ mismatch with our scope (%s).\n", inet_ntoa(p->ip), scope, global_scope())); pull_ascii_nstring(src_name, sizeof(src_name), dgram->source_name.name); if (is_myname(src_name)) { - DEBUG(0,("process_browse_packet: Discarding datagram from IP %s. Source name \ + DEBUG(7,("process_browse_packet: Discarding datagram from IP %s. Source name \ %s is one of our names !\n", inet_ntoa(p->ip), nmb_namestr(&dgram->source_name))); return; } -- cgit From 3aa147f8d20bc5124dca1f4746da678a55247b82 Mon Sep 17 00:00:00 2001 From: Jeff Layton Date: Thu, 24 Sep 2009 20:55:43 -0400 Subject: mount.cifs: print output to stderr When a mount fails, mount.cifs often prints an error message. In most cases, this error goes to stdout instead of stderr like it should. Fix it to print errors to stderr instead. Reported-by: Jan Engelhardt Signed-off-by: Jeff Layton --- client/mount.cifs.c | 209 +++++++++++++++++++++++++--------------------------- 1 file changed, 101 insertions(+), 108 deletions(-) diff --git a/client/mount.cifs.c b/client/mount.cifs.c index 4387f5945a..1c04e13c8d 100644 --- a/client/mount.cifs.c +++ b/client/mount.cifs.c @@ -273,31 +273,34 @@ BB end finish BB */ static char * check_for_domain(char **); -static void mount_cifs_usage(void) +static void mount_cifs_usage(FILE *stream) { - printf("\nUsage: %s -o \n", thisprogram); - printf("\nMount the remote target, specified as a UNC name,"); - printf(" to a local directory.\n\nOptions:\n"); - printf("\tuser=\n\tpass=\n\tdom=\n"); - printf("\nLess commonly used options:"); - printf("\n\tcredentials=,guest,perm,noperm,setuids,nosetuids,rw,ro,"); - printf("\n\tsep=,iocharset=,suid,nosuid,exec,noexec,serverino,"); - printf("\n\tmapchars,nomapchars,nolock,servernetbiosname="); - printf("\n\tdirectio,nounix,cifsacl,sec=,sign"); - printf("\n\nOptions not needed for servers supporting CIFS Unix extensions"); - printf("\n\t(e.g. unneeded for mounts to most Samba versions):"); - printf("\n\tuid=,gid=,dir_mode=,file_mode=,sfu"); - printf("\n\nRarely used options:"); - printf("\n\tport=,rsize=,wsize=,unc=,ip=,"); - printf("\n\tdev,nodev,nouser_xattr,netbiosname=,hard,soft,intr,"); - printf("\n\tnointr,ignorecase,noposixpaths,noacl,prefixpath=,nobrl"); - printf("\n\tin6_addr"); - printf("\n\nOptions are described in more detail in the manual page"); - printf("\n\tman 8 mount.cifs\n"); - printf("\nTo display the version number of the mount helper:"); - printf("\n\t%s -V\n",thisprogram); + fprintf(stream, "\nUsage: %s -o \n", thisprogram); + fprintf(stream, "\nMount the remote target, specified as a UNC name,"); + fprintf(stream, " to a local directory.\n\nOptions:\n"); + fprintf(stream, "\tuser=\n\tpass=\n\tdom=\n"); + fprintf(stream, "\nLess commonly used options:"); + fprintf(stream, "\n\tcredentials=,guest,perm,noperm,setuids,nosetuids,rw,ro,"); + fprintf(stream, "\n\tsep=,iocharset=,suid,nosuid,exec,noexec,serverino,"); + fprintf(stream, "\n\tmapchars,nomapchars,nolock,servernetbiosname="); + fprintf(stream, "\n\tdirectio,nounix,cifsacl,sec=,sign"); + fprintf(stream, "\n\nOptions not needed for servers supporting CIFS Unix extensions"); + fprintf(stream, "\n\t(e.g. unneeded for mounts to most Samba versions):"); + fprintf(stream, "\n\tuid=,gid=,dir_mode=,file_mode=,sfu"); + fprintf(stream, "\n\nRarely used options:"); + fprintf(stream, "\n\tport=,rsize=,wsize=,unc=,ip=,"); + fprintf(stream, "\n\tdev,nodev,nouser_xattr,netbiosname=,hard,soft,intr,"); + fprintf(stream, "\n\tnointr,ignorecase,noposixpaths,noacl,prefixpath=,nobrl"); + fprintf(stream, "\n\nOptions are described in more detail in the manual page"); + fprintf(stream, "\n\tman 8 mount.cifs\n"); + fprintf(stream, "\nTo display the version number of the mount helper:"); + fprintf(stream, "\n\t%s -V\n",thisprogram); SAFE_FREE(mountpassword); + + if (stream == stderr) + exit(EX_USAGE); + exit(0); } /* caller frees username if necessary */ @@ -348,7 +351,7 @@ static int open_cred_file(char * file_name) } } if(length > 4086) { - printf("mount.cifs failed due to malformed username in credentials file"); + fprintf(stderr, "mount.cifs failed due to malformed username in credentials file\n"); memset(line_buf,0,4096); exit(EX_USAGE); } else { @@ -372,7 +375,7 @@ static int open_cred_file(char * file_name) } } if(length > MOUNT_PASSWD_SIZE) { - printf("mount.cifs failed: password in credentials file too long\n"); + fprintf(stderr, "mount.cifs failed: password in credentials file too long\n"); memset(line_buf,0, 4096); exit(EX_USAGE); } else { @@ -392,7 +395,7 @@ static int open_cred_file(char * file_name) /* go past equals sign */ temp_val++; if(verboseflag) - printf("\nDomain %s\n",temp_val); + fprintf(stderr, "\nDomain %s\n",temp_val); for(length = 0;length DOMAIN_SIZE) { - printf("mount.cifs failed: domain in credentials file too long\n"); + fprintf(stderr, "mount.cifs failed: domain in credentials file too long\n"); exit(EX_USAGE); } else { if(domain_name == NULL) { @@ -434,14 +437,14 @@ static int get_password_from_file(int file_descript, char * filename) memset(mountpassword, 0, MOUNT_PASSWD_SIZE); if (mountpassword == NULL) { - printf("malloc failed\n"); + fprintf(stderr, "malloc failed\n"); exit(EX_SYSERR); } if(filename != NULL) { file_descript = open(filename, O_RDONLY); if(file_descript < 0) { - printf("mount.cifs failed. %s attempting to open password file %s\n", + fprintf(stderr, "mount.cifs failed. %s attempting to open password file %s\n", strerror(errno),filename); exit(EX_SYSERR); } @@ -451,14 +454,14 @@ static int get_password_from_file(int file_descript, char * filename) for(i=0;ipw_uid); @@ -704,7 +707,7 @@ static int parse_options(char ** optionsp, unsigned long * filesys_flags) struct group *gr; if (!(gr = getgrnam(value))) { - printf("bad group name \"%s\"\n", value); + fprintf(stderr, "bad group name \"%s\"\n", value); exit(EX_USAGE); } snprintf(group, sizeof(group), "%u", gr->gr_gid); @@ -716,32 +719,32 @@ static int parse_options(char ** optionsp, unsigned long * filesys_flags) /* fmask and dmask synonyms for people used to smbfs syntax */ } else if (strcmp(data, "file_mode") == 0 || strcmp(data, "fmask")==0) { if (!value || !*value) { - printf ("Option '%s' requires a numerical argument\n", data); + fprintf(stderr, "Option '%s' requires a numerical argument\n", data); SAFE_FREE(out); return 1; } if (value[0] != '0') { - printf ("WARNING: '%s' not expressed in octal.\n", data); + fprintf(stderr, "WARNING: '%s' not expressed in octal.\n", data); } if (strcmp (data, "fmask") == 0) { - printf ("WARNING: CIFS mount option 'fmask' is deprecated. Use 'file_mode' instead.\n"); + fprintf(stderr, "WARNING: CIFS mount option 'fmask' is deprecated. Use 'file_mode' instead.\n"); data = "file_mode"; /* BB fix this */ } } else if (strcmp(data, "dir_mode") == 0 || strcmp(data, "dmask")==0) { if (!value || !*value) { - printf ("Option '%s' requires a numerical argument\n", data); + fprintf(stderr, "Option '%s' requires a numerical argument\n", data); SAFE_FREE(out); return 1; } if (value[0] != '0') { - printf ("WARNING: '%s' not expressed in octal.\n", data); + fprintf(stderr, "WARNING: '%s' not expressed in octal.\n", data); } if (strcmp (data, "dmask") == 0) { - printf ("WARNING: CIFS mount option 'dmask' is deprecated. Use 'dir_mode' instead.\n"); + fprintf(stderr, "WARNING: CIFS mount option 'dmask' is deprecated. Use 'dir_mode' instead.\n"); data = "dir_mode"; } /* the following eight mount options should be @@ -794,7 +797,7 @@ static int parse_options(char ** optionsp, unsigned long * filesys_flags) } } else if (strnicmp(data, "version", 3) == 0) { } else { - printf("CIFS: Unknown mount option %s\n",data); + fprintf(stderr, "CIFS: Unknown mount option %s\n",data); } */ /* nothing to do on those four mount options above. Just pass to kernel and ignore them here */ @@ -888,7 +891,7 @@ static void check_for_comma(char ** ppasswrd) return; if(number_of_commas > MOUNT_PASSWD_SIZE) { /* would otherwise overflow the mount options buffer */ - printf("\nInvalid password. Password contains too many commas.\n"); + fprintf(stderr, "\nInvalid password. Password contains too many commas.\n"); return; } @@ -942,7 +945,7 @@ static char * check_for_domain(char **ppuser) } if(got_domain) { - printf("Domain name specified twice. Username probably malformed\n"); + fprintf(stderr, "Domain name specified twice. Username probably malformed\n"); return NULL; } @@ -951,7 +954,7 @@ static char * check_for_domain(char **ppuser) if (domainnm[0] != 0) { got_domain = 1; } else { - printf("null domain\n"); + fprintf(stderr, "null domain\n"); } len = strlen(domainnm); /* reset domainm to new buffer, and copy @@ -1010,18 +1013,18 @@ parse_server(char ** punc_name) int rc; if(length > (MAX_UNC_LEN - 1)) { - printf("mount error: UNC name too long"); + fprintf(stderr, "mount error: UNC name too long"); return NULL; } if ((strncasecmp("cifs://", unc_name, 7) == 0) || (strncasecmp("smb://", unc_name, 6) == 0)) { - printf("\nMounting cifs URL not implemented yet. Attempt to mount %s\n", unc_name); + fprintf(stderr, "\nMounting cifs URL not implemented yet. Attempt to mount %s\n", unc_name); return NULL; } if(length < 3) { /* BB add code to find DFS root here */ - printf("\nMounting the DFS root for domain not implemented yet\n"); + fprintf(stderr, "\nMounting the DFS root for domain not implemented yet\n"); return NULL; } else { if(strncmp(unc_name,"//",2) && strncmp(unc_name,"\\\\",2)) { @@ -1042,8 +1045,8 @@ parse_server(char ** punc_name) unc_name[length+2] = 0; goto continue_unc_parsing; } else { - printf("mount error: improperly formatted UNC name."); - printf(" %s does not begin with \\\\ or //\n",unc_name); + fprintf(stderr, "mount error: improperly formatted UNC name."); + fprintf(stderr, " %s does not begin with \\\\ or //\n",unc_name); return NULL; } } else { @@ -1059,7 +1062,7 @@ continue_unc_parsing: if(got_ip == 0) { rc = getaddrinfo(unc_name, NULL, NULL, &addrlist); if (rc != 0) { - printf("mount error: could not resolve address for %s: %s\n", + fprintf(stderr, "mount error: could not resolve address for %s: %s\n", unc_name, gai_strerror(rc)); addrlist = NULL; } @@ -1074,7 +1077,7 @@ continue_unc_parsing: } if(got_ip) { if(verboseflag) - printf("ip address specified explicitly\n"); + fprintf(stderr, "ip address specified explicitly\n"); return NULL; } /* BB should we pass an alternate version of the share name as Unicode */ @@ -1082,7 +1085,7 @@ continue_unc_parsing: return addrlist; } else { /* BB add code to find DFS root (send null path on get DFS Referral to specified server here */ - printf("Mounting the DFS root for a particular server not implemented yet\n"); + fprintf(stderr, "Mounting the DFS root for a particular server not implemented yet\n"); return NULL; } } @@ -1181,12 +1184,10 @@ int main(int argc, char ** argv) bindtextdomain(PACKAGE, LOCALEDIR); textdomain(PACKAGE); */ - if(argc && argv) { + if(argc && argv) thisprogram = argv[0]; - } else { - mount_cifs_usage(); - exit(EX_USAGE); - } + else + mount_cifs_usage(stderr); if(thisprogram == NULL) thisprogram = "mount.cifs"; @@ -1195,7 +1196,7 @@ int main(int argc, char ** argv) /* BB add workstation name and domain and pass down */ /* #ifdef _GNU_SOURCE - printf(" node: %s machine: %s sysname %s domain %s\n", sysinfo.nodename,sysinfo.machine,sysinfo.sysname,sysinfo.domainname); + fprintf(stderr, " node: %s machine: %s sysname %s domain %s\n", sysinfo.nodename,sysinfo.machine,sysinfo.sysname,sysinfo.domainname); #endif */ if(argc > 2) { dev_name = argv[1]; @@ -1216,16 +1217,11 @@ int main(int argc, char ** argv) if ((strcmp(argv[1], "-h") == 0) || (strcmp(argv[1], "-?") == 0) || (strcmp(argv[1], "--help") == 0)) - { - mount_cifs_usage(); - exit(0); - } + mount_cifs_usage(stdout); - mount_cifs_usage(); - exit(EX_USAGE); + mount_cifs_usage(stderr); } else { - mount_cifs_usage(); - exit(EX_USAGE); + mount_cifs_usage(stderr); } @@ -1246,8 +1242,7 @@ int main(int argc, char ** argv) case '?': case 'h': /* help */ - mount_cifs_usage (); - exit(0); + mount_cifs_usage(stdout); case 'n': ++nomtab; break; @@ -1297,14 +1292,14 @@ int main(int argc, char ** argv) uid = strtoul(optarg, &ep, 10); if (*ep) { - printf("bad uid value \"%s\"\n", optarg); + fprintf(stderr, "bad uid value \"%s\"\n", optarg); exit(EX_USAGE); } } else { struct passwd *pw; if (!(pw = getpwnam(optarg))) { - printf("bad user name \"%s\"\n", optarg); + fprintf(stderr, "bad user name \"%s\"\n", optarg); exit(EX_USAGE); } uid = pw->pw_uid; @@ -1317,14 +1312,14 @@ int main(int argc, char ** argv) gid = strtoul(optarg, &ep, 10); if (*ep) { - printf("bad gid value \"%s\"\n", optarg); + fprintf(stderr, "bad gid value \"%s\"\n", optarg); exit(EX_USAGE); } } else { struct group *gr; if (!(gr = getgrnam(optarg))) { - printf("bad user name \"%s\"\n", optarg); + fprintf(stderr, "bad user name \"%s\"\n", optarg); exit(EX_USAGE); } gid = gr->gr_gid; @@ -1356,15 +1351,13 @@ int main(int argc, char ** argv) ++fakemnt; break; default: - printf("unknown mount option %c\n",c); - mount_cifs_usage(); - exit(EX_USAGE); + fprintf(stderr, "unknown mount option %c\n",c); + mount_cifs_usage(stderr); } } if((argc < 3) || (dev_name == NULL) || (mountpoint == NULL)) { - mount_cifs_usage(); - exit(EX_USAGE); + mount_cifs_usage(stderr); } /* make sure mountpoint is legit */ @@ -1423,7 +1416,7 @@ int main(int argc, char ** argv) addrhead = addr = parse_server(&share_name); if((addrhead == NULL) && (got_ip == 0)) { - printf("No ip address specified and hostname not found\n"); + fprintf(stderr, "No ip address specified and hostname not found\n"); rc = EX_USAGE; goto mount_exit; } @@ -1453,7 +1446,7 @@ int main(int argc, char ** argv) no good replacement yet. */ mountpassword = (char *)calloc(MOUNT_PASSWD_SIZE+1,1); if (!tmp_pass || !mountpassword) { - printf("Password not entered, exiting\n"); + fprintf(stderr, "Password not entered, exiting\n"); exit(EX_USAGE); } strlcpy(mountpassword, tmp_pass, MOUNT_PASSWD_SIZE+1); @@ -1469,8 +1462,8 @@ int main(int argc, char ** argv) if(share_name) optlen += strlen(share_name) + 4; else { - printf("No server share name specified\n"); - printf("\nMounting the DFS root for server not implemented yet\n"); + fprintf(stderr, "No server share name specified\n"); + fprintf(stderr, "\nMounting the DFS root for server not implemented yet\n"); exit(EX_USAGE); } if(user_name) @@ -1484,7 +1477,7 @@ mount_retry: options = (char *)malloc(options_size /* space for commas in password */ + 8 /* space for domain= , domain name itself was counted as part of the length username string above */); if(options == NULL) { - printf("Could not allocate memory for mount options\n"); + fprintf(stderr, "Could not allocate memory for mount options\n"); exit(EX_SYSERR); } @@ -1530,7 +1523,7 @@ mount_retry: strlcat(options,prefixpath,options_size); /* no need to cat the / */ } if(verboseflag) - printf("\nmount.cifs kernel mount options %s \n",options); + fprintf(stderr, "\nmount.cifs kernel mount options %s \n",options); /* convert all '\\' to '/' in share portion so that /proc/mounts looks pretty */ replace_char(dev_name, '\\', '/', strlen(share_name)); @@ -1583,7 +1576,7 @@ mount_retry: } break; case ENODEV: - printf("mount error: cifs filesystem not supported by the system\n"); + fprintf(stderr, "mount error: cifs filesystem not supported by the system\n"); break; case ENXIO: if(retry == 0) { @@ -1591,13 +1584,13 @@ mount_retry: if (uppercase_string(dev_name) && uppercase_string(share_name) && uppercase_string(prefixpath)) { - printf("retrying with upper case share name\n"); + fprintf(stderr, "retrying with upper case share name\n"); goto mount_retry; } } } - printf("mount error(%d): %s\n", errno, strerror(errno)); - printf("Refer to the mount.cifs(8) manual page (e.g. man " + fprintf(stderr, "mount error(%d): %s\n", errno, strerror(errno)); + fprintf(stderr, "Refer to the mount.cifs(8) manual page (e.g. man " "mount.cifs)\n"); rc = EX_FAIL; goto mount_exit; @@ -1608,12 +1601,12 @@ mount_retry: atexit(unlock_mtab); rc = lock_mtab(); if (rc) { - printf("cannot lock mtab"); + fprintf(stderr, "cannot lock mtab"); goto mount_exit; } pmntfile = setmntent(MOUNTED, "a+"); if (!pmntfile) { - printf("could not update mount table\n"); + fprintf(stderr, "could not update mount table\n"); unlock_mtab(); rc = EX_FILEIO; goto mount_exit; -- cgit