From 80c1f1d865b13a63c7a60876b63458119566e044 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Tue, 22 Jul 2003 04:31:20 +0000 Subject: Fixup a bunch of printf-style functions and debugs to use unsigned long when displaying pid_t, uid_t and gid_t values. This removes a whole lot of warnings on some of the 64-bit build farm machines as well as help us out when 64-bit uid/gid/pid values come along. (This used to be commit f93528ba007c8800a850678f35f499fb7360fb9a) --- source3/nsswitch/winbindd_acct.c | 47 ++++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 23 deletions(-) (limited to 'source3/nsswitch/winbindd_acct.c') diff --git a/source3/nsswitch/winbindd_acct.c b/source3/nsswitch/winbindd_acct.c index a1cd1d5f19..6bd89a36e6 100644 --- a/source3/nsswitch/winbindd_acct.c +++ b/source3/nsswitch/winbindd_acct.c @@ -136,8 +136,8 @@ static WINBINDD_PW* string2passwd( char *string ) /* last minute sanity checks */ if ( pw.pw_uid==0 || pw.pw_gid==0 ) { - DEBUG(0,("string2passwd: Failure! uid==%d, gid==%d\n", - pw.pw_uid, pw.pw_gid)); + DEBUG(0,("string2passwd: Failure! uid==%lu, gid==%lu\n", + (unsigned long)pw.pw_uid, (unsigned long)pw.pw_gid)); return NULL; } @@ -161,11 +161,11 @@ static char* passwd2string( const WINBINDD_PW *pw ) DEBUG(10,("passwd2string: converting passwd struct for %s\n", pw->pw_name)); - ret = snprintf( string, sizeof(string), "%s:%s:%d:%d:%s:%s:%s", + ret = snprintf( string, sizeof(string), "%s:%s:%lu:%lu:%s:%s:%s", pw->pw_name, pw->pw_passwd ? pw->pw_passwd : "x", - pw->pw_uid, - pw->pw_gid, + (unsigned long)pw->pw_uid, + (unsigned long)pw->pw_gid, pw->pw_gecos, pw->pw_dir, pw->pw_shell ); @@ -247,7 +247,7 @@ static WINBINDD_GR* string2group( char *string ) /* last minute sanity checks */ if ( grp.gr_gid == 0 ) { - DEBUG(0,("string2group: Failure! gid==%d\n", grp.gr_gid)); + DEBUG(0,("string2group: Failure! gid==%lu\n", (unsigned long)grp.gr_gid)); SAFE_FREE( gr_members ); return NULL; } @@ -303,10 +303,10 @@ static char* group2string( const WINBINDD_GR *grp ) fstrcpy( gr_mem_str, "" ); } - ret = snprintf( string, sizeof(string)-1, "%s:%s:%d:%s", + ret = snprintf( string, sizeof(string)-1, "%s:%s:%lu:%s", grp->gr_name, grp->gr_passwd ? grp->gr_passwd : "*", - grp->gr_gid, + (unsigned long)grp->gr_gid, gr_mem_str ); SAFE_FREE( gr_mem_str ); @@ -338,7 +338,7 @@ static char* acct_userkey_byuid( uid_t uid ) { static fstring key; - snprintf( key, sizeof(key), "%s/UID/%d", WBKEY_PASSWD, uid ); + snprintf( key, sizeof(key), "%s/UID/%lu", WBKEY_PASSWD, (unsigned long)uid ); return key; } @@ -362,7 +362,7 @@ static char* acct_groupkey_bygid( gid_t gid ) { static fstring key; - snprintf( key, sizeof(key), "%s/GID/%d", WBKEY_GROUP, gid ); + snprintf( key, sizeof(key), "%s/GID/%lu", WBKEY_GROUP, (unsigned long)gid ); return key; } @@ -415,7 +415,7 @@ WINBINDD_PW* wb_getpwuid( const uid_t uid ) data = tdb_fetch_bystring( account_tdb, acct_userkey_byuid(uid) ); if ( !data.dptr ) { - DEBUG(4,("wb_getpwuid: failed to locate uid == %d\n", uid)); + DEBUG(4,("wb_getpwuid: failed to locate uid == %lu\n", (unsigned long)uid)); return NULL; } keystr = acct_userkey_byname( data.dptr ); @@ -431,8 +431,8 @@ WINBINDD_PW* wb_getpwuid( const uid_t uid ) SAFE_FREE( data.dptr ); } - DEBUG(5,("wb_getpwuid: %s user (uid == %d)\n", - (pw ? "Found" : "Did not find"), uid )); + DEBUG(5,("wb_getpwuid: %s user (uid == %lu)\n", + (pw ? "Found" : "Did not find"), (unsigned long)uid )); return pw; } @@ -544,7 +544,8 @@ WINBINDD_GR* wb_getgrgid( gid_t gid ) data = tdb_fetch_bystring( account_tdb, acct_groupkey_bygid(gid) ); if ( !data.dptr ) { - DEBUG(4,("wb_getgrgid: failed to locate gid == %d\n", gid)); + DEBUG(4,("wb_getgrgid: failed to locate gid == %lu\n", + (unsigned long)gid)); return NULL; } keystr = acct_groupkey_byname( data.dptr ); @@ -560,8 +561,8 @@ WINBINDD_GR* wb_getgrgid( gid_t gid ) SAFE_FREE( data.dptr ); } - DEBUG(5,("wb_getgrgid: %s group (gid == %d)\n", - (grp ? "Found" : "Did not find"), gid )); + DEBUG(5,("wb_getgrgid: %s group (gid == %lu)\n", + (grp ? "Found" : "Did not find"), (unsigned long)gid )); return grp; } @@ -875,8 +876,8 @@ enum winbindd_result winbindd_create_user(struct winbindd_cli_state *state) user = state->request.data.acct_mgt.username; group = state->request.data.acct_mgt.groupname; - DEBUG(3, ("[%5d]: create_user: user=>(%s), group=>(%s)\n", - state->pid, user, group)); + DEBUG(3, ("[%5lu]: create_user: user=>(%s), group=>(%s)\n", + (unsigned long)state->pid, user, group)); if ( !*group ) group = lp_template_primary_group(); @@ -965,7 +966,7 @@ enum winbindd_result winbindd_create_group(struct winbindd_cli_state *state) state->request.data.acct_mgt.groupname[sizeof(state->request.data.acct_mgt.groupname)-1]='\0'; group = state->request.data.acct_mgt.groupname; - DEBUG(3, ("[%5d]: create_group: (%s)\n", state->pid, group)); + DEBUG(3, ("[%5lu]: create_group: (%s)\n", (unsigned long)state->pid, group)); /* get a new uid */ @@ -1025,7 +1026,7 @@ enum winbindd_result winbindd_add_user_to_group(struct winbindd_cli_state *state group = state->request.data.acct_mgt.groupname; user = state->request.data.acct_mgt.username; - DEBUG(3, ("[%5d]: add_user_to_group: add %s to %s\n", state->pid, + DEBUG(3, ("[%5lu]: add_user_to_group: add %s to %s\n", (unsigned long)state->pid, user, group)); /* make sure it is a valid user */ @@ -1073,7 +1074,7 @@ enum winbindd_result winbindd_remove_user_from_group(struct winbindd_cli_state * group = state->request.data.acct_mgt.groupname; user = state->request.data.acct_mgt.username; - DEBUG(3, ("[%5d]: remove_user_to_group: delete %s from %s\n", state->pid, + DEBUG(3, ("[%5lu]: remove_user_to_group: delete %s from %s\n", (unsigned long)state->pid, user, group)); /* don't worry about checking the username since we're removing it anyways */ @@ -1158,7 +1159,7 @@ enum winbindd_result winbindd_delete_user(struct winbindd_cli_state *state) state->request.data.acct_mgt.username[sizeof(state->request.data.acct_mgt.username)-1]='\0'; user = state->request.data.acct_mgt.username; - DEBUG(3, ("[%5d]: delete_user: %s\n", state->pid, user)); + DEBUG(3, ("[%5lu]: delete_user: %s\n", (unsigned long)state->pid, user)); /* make sure it is a valid user */ @@ -1189,7 +1190,7 @@ enum winbindd_result winbindd_delete_group(struct winbindd_cli_state *state) state->request.data.acct_mgt.username[sizeof(state->request.data.acct_mgt.groupname)-1]='\0'; group = state->request.data.acct_mgt.groupname; - DEBUG(3, ("[%5d]: delete_group: %s\n", state->pid, group)); + DEBUG(3, ("[%5lu]: delete_group: %s\n", (unsigned long)state->pid, group)); /* make sure it is a valid group */ -- cgit