Skip to content

Commit

Permalink
Fix a bunch of compiler warnings about wrong format types.
Browse files Browse the repository at this point in the history
Should make Solaris 10 builds look cleaner.
Jeremy.
  • Loading branch information
jrasamba committed May 12, 2009
1 parent 14c1e9f commit b4c9cfb
Show file tree
Hide file tree
Showing 19 changed files with 84 additions and 76 deletions.
42 changes: 23 additions & 19 deletions nsswitch/wbinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -168,11 +168,11 @@ static bool wbinfo_get_userinfo(char *user)
return false;
}

d_printf("%s:%s:%d:%d:%s:%s:%s\n",
d_printf("%s:%s:%u:%u:%s:%s:%s\n",
pwd->pw_name,
pwd->pw_passwd,
pwd->pw_uid,
pwd->pw_gid,
(unsigned int)pwd->pw_uid,
(unsigned int)pwd->pw_gid,
pwd->pw_gecos,
pwd->pw_dir,
pwd->pw_shell);
Expand All @@ -191,11 +191,11 @@ static bool wbinfo_get_uidinfo(int uid)
return false;
}

d_printf("%s:%s:%d:%d:%s:%s:%s\n",
d_printf("%s:%s:%u:%u:%s:%s:%s\n",
pwd->pw_name,
pwd->pw_passwd,
pwd->pw_uid,
pwd->pw_gid,
(unsigned int)pwd->pw_uid,
(unsigned int)pwd->pw_gid,
pwd->pw_gecos,
pwd->pw_dir,
pwd->pw_shell);
Expand All @@ -215,11 +215,11 @@ static bool wbinfo_get_user_sidinfo(const char *sid_str)
return false;
}

d_printf("%s:%s:%d:%d:%s:%s:%s\n",
d_printf("%s:%s:%u:%u:%s:%s:%s\n",
pwd->pw_name,
pwd->pw_passwd,
pwd->pw_uid,
pwd->pw_gid,
(unsigned int)pwd->pw_uid,
(unsigned int)pwd->pw_gid,
pwd->pw_gecos,
pwd->pw_dir,
pwd->pw_shell);
Expand All @@ -239,10 +239,10 @@ static bool wbinfo_get_groupinfo(const char *group)
return false;
}

d_printf("%s:%s:%d\n",
d_printf("%s:%s:%u\n",
grp->gr_name,
grp->gr_passwd,
grp->gr_gid);
(unsigned int)grp->gr_gid);

wbcFreeMemory(grp);

Expand All @@ -260,10 +260,10 @@ static bool wbinfo_get_gidinfo(int gid)
return false;
}

d_printf("%s:%s:%d\n",
d_printf("%s:%s:%u\n",
grp->gr_name,
grp->gr_passwd,
grp->gr_gid);
(unsigned int)grp->gr_gid);

wbcFreeMemory(grp);

Expand Down Expand Up @@ -844,7 +844,7 @@ static bool wbinfo_allocate_uid(void)

/* Display response */

d_printf("New uid: %d\n", uid);
d_printf("New uid: %u\n", (unsigned int)uid);

return true;
}
Expand All @@ -863,7 +863,7 @@ static bool wbinfo_allocate_gid(void)

/* Display response */

d_printf("New gid: %d\n", gid);
d_printf("New gid: %u\n", (unsigned int)gid);

return true;
}
Expand All @@ -887,7 +887,8 @@ static bool wbinfo_set_uid_mapping(uid_t uid, const char *sid_str)

/* Display response */

d_printf("uid %d now mapped to sid %s\n", uid, sid_str);
d_printf("uid %u now mapped to sid %s\n",
(unsigned int)uid, sid_str);

return true;
}
Expand All @@ -911,7 +912,8 @@ static bool wbinfo_set_gid_mapping(gid_t gid, const char *sid_str)

/* Display response */

d_printf("gid %d now mapped to sid %s\n", gid, sid_str);
d_printf("gid %u now mapped to sid %s\n",
(unsigned int)gid, sid_str);

return true;
}
Expand All @@ -935,7 +937,8 @@ static bool wbinfo_remove_uid_mapping(uid_t uid, const char *sid_str)

/* Display response */

d_printf("Removed uid %d to sid %s mapping\n", uid, sid_str);
d_printf("Removed uid %u to sid %s mapping\n",
(unsigned int)uid, sid_str);

return true;
}
Expand All @@ -959,7 +962,8 @@ static bool wbinfo_remove_gid_mapping(gid_t gid, const char *sid_str)

/* Display response */

d_printf("Removed gid %d to sid %s mapping\n", gid, sid_str);
d_printf("Removed gid %u to sid %s mapping\n",
(unsigned int)gid, sid_str);

return true;
}
Expand Down
10 changes: 5 additions & 5 deletions source3/auth/auth_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -777,7 +777,7 @@ NTSTATUS create_local_token(auth_serversupplied_info *server_info)

if (!uid_to_unix_users_sid(server_info->utok.uid, &tmp_sid)) {
DEBUG(1,("create_local_token: Failed to create SID "
"for uid %d!\n", server_info->utok.uid));
"for uid %u!\n", (unsigned int)server_info->utok.uid));
}
add_sid_to_array_unique(server_info->ptok, &tmp_sid,
&server_info->ptok->user_sids,
Expand All @@ -786,7 +786,7 @@ NTSTATUS create_local_token(auth_serversupplied_info *server_info)
for ( i=0; i<server_info->utok.ngroups; i++ ) {
if (!gid_to_unix_groups_sid( server_info->utok.groups[i], &tmp_sid ) ) {
DEBUG(1,("create_local_token: Failed to create SID "
"for gid %d!\n", server_info->utok.groups[i]));
"for gid %u!\n", (unsigned int)server_info->utok.groups[i]));
continue;
}
add_sid_to_array_unique(server_info->ptok, &tmp_sid,
Expand Down Expand Up @@ -954,8 +954,8 @@ NTSTATUS create_token_from_username(TALLOC_CTX *mem_ctx, const char *username,

pass = getpwuid_alloc(tmp_ctx, *uid);
if (pass == NULL) {
DEBUG(1, ("getpwuid(%d) for user %s failed\n",
*uid, username));
DEBUG(1, ("getpwuid(%u) for user %s failed\n",
(unsigned int)*uid, username));
goto done;
}

Expand Down Expand Up @@ -1049,7 +1049,7 @@ NTSTATUS create_token_from_username(TALLOC_CTX *mem_ctx, const char *username,

if ( !gid_to_unix_groups_sid( gids[i], &unix_group_sid ) ) {
DEBUG(1,("create_token_from_username: Failed to create SID "
"for gid %d!\n", gids[i]));
"for gid %u!\n", (unsigned int)gids[i]));
continue;
}
result = add_sid_to_array_unique(tmp_ctx, &unix_group_sid,
Expand Down
6 changes: 3 additions & 3 deletions source3/groupdb/mapping.c
Original file line number Diff line number Diff line change
Expand Up @@ -516,8 +516,8 @@ NTSTATUS pdb_default_create_alias(struct pdb_methods *methods,
return NT_STATUS_ACCESS_DENIED;
}

DEBUG(10, ("Creating alias %s with gid %d and rid %d\n",
name, gid, new_rid));
DEBUG(10, ("Creating alias %s with gid %u and rid %u\n",
name, (unsigned int)gid, (unsigned int)new_rid));

sid_copy(&sid, get_global_sam_sid());
sid_append_rid(&sid, new_rid);
Expand Down Expand Up @@ -787,7 +787,7 @@ NTSTATUS pdb_create_builtin_alias(uint32 rid)
return NT_STATUS_ACCESS_DENIED;
}

DEBUG(10,("Creating alias %s with gid %d\n", groupname, gid));
DEBUG(10,("Creating alias %s with gid %u\n", groupname, (unsigned int)gid));

map.gid = gid;
sid_copy(&map.sid, &sid);
Expand Down
14 changes: 7 additions & 7 deletions source3/modules/vfs_solarisacl.c
Original file line number Diff line number Diff line change
Expand Up @@ -367,13 +367,13 @@ static bool smb_acl_to_solaris_acl(SMB_ACL_T smb_acl,
}
switch(solaris_entry.a_type) {
case USER:
DEBUG(10, ("got tag type USER with uid %d\n",
smb_entry->uid));
DEBUG(10, ("got tag type USER with uid %u\n",
(unsigned int)smb_entry->uid));
solaris_entry.a_id = (uid_t)smb_entry->uid;
break;
case GROUP:
DEBUG(10, ("got tag type GROUP with gid %d\n",
smb_entry->gid));
DEBUG(10, ("got tag type GROUP with gid %u\n",
(unsigned int)smb_entry->gid));
solaris_entry.a_id = (uid_t)smb_entry->gid;
break;
default:
Expand All @@ -388,7 +388,7 @@ static bool smb_acl_to_solaris_acl(SMB_ACL_T smb_acl,
smb_perm_to_solaris_perm(smb_entry->a_perm);
DEBUG(10, ("assembled the following solaris ace:\n"));
DEBUGADD(10, (" - type: 0x%04x\n", solaris_entry.a_type));
DEBUGADD(10, (" - id: %d\n", solaris_entry.a_id));
DEBUGADD(10, (" - id: %u\n", (unsigned int)solaris_entry.a_id));
DEBUGADD(10, (" - perm: o%o\n", solaris_entry.a_perm));
if (!solaris_add_to_acl(solaris_acl, count, &solaris_entry,
1, type))
Expand All @@ -400,8 +400,8 @@ static bool smb_acl_to_solaris_acl(SMB_ACL_T smb_acl,
DEBUG(10, ("test, if entry has been copied into acl:\n"));
DEBUGADD(10, (" - type: 0x%04x\n",
(*solaris_acl)[(*count)-1].a_type));
DEBUGADD(10, (" - id: %d\n",
(*solaris_acl)[(*count)-1].a_id));
DEBUGADD(10, (" - id: %u\n",
(unsigned int)(*solaris_acl)[(*count)-1].a_id));
DEBUGADD(10, (" - perm: o%o\n",
(*solaris_acl)[(*count)-1].a_perm));
}
Expand Down
4 changes: 2 additions & 2 deletions source3/passdb/lookup_sid.c
Original file line number Diff line number Diff line change
Expand Up @@ -1319,7 +1319,7 @@ void uid_to_sid(DOM_SID *psid, uid_t uid)
* the next time we ask.
*/
DEBUG(5, ("uid_to_sid: winbind failed to find a sid "
"for uid %u\n", uid));
"for uid %u\n", (unsigned int)uid));

legacy_uid_to_sid(psid, uid);
return;
Expand Down Expand Up @@ -1372,7 +1372,7 @@ void gid_to_sid(DOM_SID *psid, gid_t gid)
* the next time we ask.
*/
DEBUG(5, ("gid_to_sid: winbind failed to find a sid "
"for gid %u\n", gid));
"for gid %u\n", (unsigned int)gid));

legacy_gid_to_sid(psid, gid);
return;
Expand Down
2 changes: 1 addition & 1 deletion source3/passdb/pdb_interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -1210,7 +1210,7 @@ static bool pdb_default_uid_to_sid(struct pdb_methods *methods, uid_t uid,

if (!ret) {
DEBUG(5, ("pdb_default_uid_to_rid: Did not find user "
"%s (%d)\n", unix_pw->pw_name, uid));
"%s (%u)\n", unix_pw->pw_name, (unsigned int)uid));
TALLOC_FREE(sampw);
return False;
}
Expand Down
14 changes: 7 additions & 7 deletions source3/passdb/pdb_ldap.c
Original file line number Diff line number Diff line change
Expand Up @@ -2859,8 +2859,8 @@ static NTSTATUS ldapsam_enum_group_memberships(struct pdb_methods *methods,
}

filter = talloc_asprintf(mem_ctx,
"(&(objectClass=%s)(|(memberUid=%s)(gidNumber=%d)))",
LDAP_OBJ_POSIXGROUP, escape_name, primary_gid);
"(&(objectClass=%s)(|(memberUid=%s)(gidNumber=%u)))",
LDAP_OBJ_POSIXGROUP, escape_name, (unsigned int)primary_gid);
if (filter == NULL) {
ret = NT_STATUS_NO_MEMORY;
goto done;
Expand Down Expand Up @@ -2969,7 +2969,7 @@ static NTSTATUS ldapsam_map_posixgroup(TALLOC_CTX *mem_ctx,

filter = talloc_asprintf(mem_ctx,
"(&(objectClass=%s)(gidNumber=%u))",
LDAP_OBJ_POSIXGROUP, map->gid);
LDAP_OBJ_POSIXGROUP, (unsigned int)map->gid);
if (filter == NULL) {
return NT_STATUS_NO_MEMORY;
}
Expand Down Expand Up @@ -3092,8 +3092,8 @@ static NTSTATUS ldapsam_add_group_mapping_entry(struct pdb_methods *methods,
}

if (pdb_gid_to_sid(map->gid, &sid)) {
DEBUG(3, ("Gid %d is already mapped to SID %s, refusing to "
"add\n", map->gid, sid_string_dbg(&sid)));
DEBUG(3, ("Gid %u is already mapped to SID %s, refusing to "
"add\n", (unsigned int)map->gid, sid_string_dbg(&sid)));
result = NT_STATUS_GROUP_EXISTS;
goto done;
}
Expand Down Expand Up @@ -3124,7 +3124,7 @@ static NTSTATUS ldapsam_add_group_mapping_entry(struct pdb_methods *methods,
smbldap_make_mod(ldap_state->smbldap_state->ldap_struct, NULL, &mods, "description",
map->comment);
smbldap_make_mod(ldap_state->smbldap_state->ldap_struct, NULL, &mods, "gidNumber",
talloc_asprintf(mem_ctx, "%u", map->gid));
talloc_asprintf(mem_ctx, "%u", (unsigned int)map->gid));
talloc_autofree_ldapmod(mem_ctx, mods);

rc = smbldap_add(ldap_state->smbldap_state, dn, mods);
Expand Down Expand Up @@ -3170,7 +3170,7 @@ static NTSTATUS ldapsam_update_group_mapping_entry(struct pdb_methods *methods,
"(sambaGroupType=%d))",
LDAP_OBJ_GROUPMAP,
sid_string_talloc(mem_ctx, &map->sid),
map->gid, map->sid_name_use);
(unsigned int)map->gid, map->sid_name_use);
if (filter == NULL) {
result = NT_STATUS_NO_MEMORY;
goto done;
Expand Down
4 changes: 2 additions & 2 deletions source3/rpc_server/srv_samr_nt.c
Original file line number Diff line number Diff line change
Expand Up @@ -5625,8 +5625,8 @@ NTSTATUS _samr_CreateDomAlias(pipes_struct *p,

/* check if the group has been successfully created */
if ( getgrgid(gid) == NULL ) {
DEBUG(10, ("getgrgid(%d) of just created alias failed\n",
gid));
DEBUG(10, ("getgrgid(%u) of just created alias failed\n",
(unsigned int)gid));
return NT_STATUS_ACCESS_DENIED;
}

Expand Down
7 changes: 4 additions & 3 deletions source3/rpcclient/cmd_spoolss.c
Original file line number Diff line number Diff line change
Expand Up @@ -1107,7 +1107,7 @@ static void display_print_driver6(struct spoolss_DriverInfo6 *r)
}

printf("\tDriver Date: [%s]\n", nt_time_string(talloc_tos(), r->driver_date));
printf("\tDriver Version: [0x%016llx]\n", r->driver_version);
printf("\tDriver Version: [0x%016llx]\n", (long long unsigned int)r->driver_version);
printf("\tManufacturer Name: [%s]\n", r->manufacturer_name);
printf("\tManufacturer Url: [%s]\n", r->manufacturer_url);
printf("\tHardware ID: [%s]\n", r->hardware_id);
Expand Down Expand Up @@ -1147,7 +1147,7 @@ static void display_print_driver8(struct spoolss_DriverInfo8 *r)
}

printf("\tDriver Date: [%s]\n", nt_time_string(talloc_tos(), r->driver_date));
printf("\tDriver Version: [0x%016llx]\n", r->driver_version);
printf("\tDriver Version: [0x%016llx]\n", (long long unsigned int)r->driver_version);
printf("\tManufacturer Name: [%s]\n", r->manufacturer_name);
printf("\tManufacturer Url: [%s]\n", r->manufacturer_url);
printf("\tHardware ID: [%s]\n", r->hardware_id);
Expand All @@ -1163,7 +1163,8 @@ static void display_print_driver8(struct spoolss_DriverInfo8 *r)
printf("\tCore Driver Dependencies: [%s]\n", r->core_driver_dependencies[i]);
}
printf("\tMin Driver Inbox Driver Version Date: [%s]\n", nt_time_string(talloc_tos(), r->min_inbox_driver_ver_date));
printf("\tMin Driver Inbox Driver Version Version: [0x%016llx]\n", r->min_inbox_driver_ver_version);
printf("\tMin Driver Inbox Driver Version Version: [0x%016llx]\n",
(long long unsigned int)r->min_inbox_driver_ver_version);

printf("\n");
}
Expand Down
8 changes: 4 additions & 4 deletions source3/torture/cmd_vfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ static NTSTATUS cmd_readdir(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc
printf(" Device: 0x%10x", (unsigned int)st.st_dev);
printf(" Inode: %10u", (unsigned int)st.st_ino);
printf(" Links: %10u\n", (unsigned int)st.st_nlink);
printf(" Access: %05o", (st.st_mode) & 007777);
printf(" Access: %05o", (int)((st.st_mode) & 007777));
printf(" Uid: %5lu Gid: %5lu\n",
(unsigned long)st.st_uid,
(unsigned long)st.st_gid);
Expand Down Expand Up @@ -578,7 +578,7 @@ static NTSTATUS cmd_stat(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, c
printf(" Device: 0x%10x", (unsigned int)st.st_dev);
printf(" Inode: %10u", (unsigned int)st.st_ino);
printf(" Links: %10u\n", (unsigned int)st.st_nlink);
printf(" Access: %05o", (st.st_mode) & 007777);
printf(" Access: %05o", (int)((st.st_mode) & 007777));
printf(" Uid: %5lu/%.16s Gid: %5lu/%.16s\n", (unsigned long)st.st_uid, user,
(unsigned long)st.st_gid, group);
printf(" Access: %s", ctime(&(st.st_atime)));
Expand Down Expand Up @@ -644,7 +644,7 @@ static NTSTATUS cmd_fstat(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc,
printf(" Device: 0x%10x", (unsigned int)st.st_dev);
printf(" Inode: %10u", (unsigned int)st.st_ino);
printf(" Links: %10u\n", (unsigned int)st.st_nlink);
printf(" Access: %05o", (st.st_mode) & 007777);
printf(" Access: %05o", (int)((st.st_mode) & 007777));
printf(" Uid: %5lu/%.16s Gid: %5lu/%.16s\n", (unsigned long)st.st_uid, user,
(unsigned long)st.st_gid, group);
printf(" Access: %s", ctime(&(st.st_atime)));
Expand Down Expand Up @@ -698,7 +698,7 @@ static NTSTATUS cmd_lstat(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc,
printf(" Device: 0x%10x", (unsigned int)st.st_dev);
printf(" Inode: %10u", (unsigned int)st.st_ino);
printf(" Links: %10u\n", (unsigned int)st.st_nlink);
printf(" Access: %05o", (st.st_mode) & 007777);
printf(" Access: %05o", (int)((st.st_mode) & 007777));
printf(" Uid: %5lu/%.16s Gid: %5lu/%.16s\n", (unsigned long)st.st_uid, user,
(unsigned long)st.st_gid, group);
printf(" Access: %s", ctime(&(st.st_atime)));
Expand Down
2 changes: 1 addition & 1 deletion source3/utils/net_groupmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ static void print_map_entry ( GROUP_MAP map, bool long_list )
else {
d_printf("%s\n", map.nt_name);
d_printf("\tSID : %s\n", sid_string_tos(&map.sid));
d_printf("\tUnix gid : %d\n", map.gid);
d_printf("\tUnix gid : %u\n", (unsigned int)map.gid);
d_printf("\tUnix group: %s\n", gidtoname(map.gid));
d_printf("\tGroup type: %s\n",
sid_type_lookup(map.sid_name_use));
Expand Down
4 changes: 2 additions & 2 deletions source3/utils/net_rpc.c
Original file line number Diff line number Diff line change
Expand Up @@ -4088,8 +4088,8 @@ static bool get_user_sids(const char *domain, const char *user, NT_USER_TOKEN *t

wbc_status = wbcGidToSid(gid, &wsid);
if (!WBC_ERROR_IS_OK(wbc_status)) {
DEBUG(1, ("winbind could not find SID of gid %d: %s\n",
gid, wbcErrorString(wbc_status)));
DEBUG(1, ("winbind could not find SID of gid %u: %s\n",
(unsigned int)gid, wbcErrorString(wbc_status)));
wbcFreeMemory(groups);
return false;
}
Expand Down
Loading

0 comments on commit b4c9cfb

Please sign in to comment.