Fix a bunch of compiler warnings about wrong format types.
[ira/wip.git] / source3 / utils / net_sam.c
index ce132131f7332f517618580ad4c38d721d84edc8..6b3f5e572117781bb7c880fa76b214c060748a44 100644 (file)
@@ -1269,28 +1269,31 @@ static int net_sam_do_list(struct net_context *c, int argc, const char **argv,
                }
        }
 
-       pdb_search_destroy(search);
+       TALLOC_FREE(search);
        return 0;
 }
 
 static int net_sam_list_users(struct net_context *c, int argc,
                              const char **argv)
 {
-       return net_sam_do_list(c, argc, argv, pdb_search_users(ACB_NORMAL),
+       return net_sam_do_list(c, argc, argv,
+                              pdb_search_users(talloc_tos(), ACB_NORMAL),
                               "users");
 }
 
 static int net_sam_list_groups(struct net_context *c, int argc,
                               const char **argv)
 {
-       return net_sam_do_list(c, argc, argv, pdb_search_groups(), "groups");
+       return net_sam_do_list(c, argc, argv, pdb_search_groups(talloc_tos()),
+                              "groups");
 }
 
 static int net_sam_list_localgroups(struct net_context *c, int argc,
                                    const char **argv)
 {
        return net_sam_do_list(c, argc, argv,
-                              pdb_search_aliases(get_global_sam_sid()),
+                              pdb_search_aliases(talloc_tos(),
+                                                 get_global_sam_sid()),
                               "localgroups");
 }
 
@@ -1298,7 +1301,8 @@ static int net_sam_list_builtin(struct net_context *c, int argc,
                                const char **argv)
 {
        return net_sam_do_list(c, argc, argv,
-                              pdb_search_aliases(&global_sid_Builtin),
+                              pdb_search_aliases(talloc_tos(),
+                                                 &global_sid_Builtin),
                               "builtin");
 }
 
@@ -1306,7 +1310,7 @@ static int net_sam_list_workstations(struct net_context *c, int argc,
                                     const char **argv)
 {
        return net_sam_do_list(c, argc, argv,
-                              pdb_search_users(ACB_WSTRUST),
+                              pdb_search_users(talloc_tos(), ACB_WSTRUST),
                               "workstations");
 }
 
@@ -1486,7 +1490,7 @@ static int net_sam_provision(struct net_context *c, int argc, const char **argv)
                uname = talloc_strdup(tc, "domusers");
                wname = talloc_strdup(tc, "Domain Users");
                dn = talloc_asprintf(tc, "cn=%s,%s", "domusers", lp_ldap_group_suffix());
-               gidstr = talloc_asprintf(tc, "%d", domusers_gid);
+               gidstr = talloc_asprintf(tc, "%u", (unsigned int)domusers_gid);
                gtype = talloc_asprintf(tc, "%d", SID_NAME_DOM_GRP);
 
                if (!uname || !wname || !dn || !gidstr || !gtype) {
@@ -1541,7 +1545,7 @@ domu_done:
                uname = talloc_strdup(tc, "domadmins");
                wname = talloc_strdup(tc, "Domain Admins");
                dn = talloc_asprintf(tc, "cn=%s,%s", "domadmins", lp_ldap_group_suffix());
-               gidstr = talloc_asprintf(tc, "%d", domadmins_gid);
+               gidstr = talloc_asprintf(tc, "%u", (unsigned int)domadmins_gid);
                gtype = talloc_asprintf(tc, "%d", SID_NAME_DOM_GRP);
 
                if (!uname || !wname || !dn || !gidstr || !gtype) {
@@ -1604,8 +1608,8 @@ doma_done:
                }
                name = talloc_strdup(tc, "Administrator");
                dn = talloc_asprintf(tc, "uid=Administrator,%s", lp_ldap_user_suffix());
-               uidstr = talloc_asprintf(tc, "%d", uid);
-               gidstr = talloc_asprintf(tc, "%d", domadmins_gid);
+               uidstr = talloc_asprintf(tc, "%u", (unsigned int)uid);
+               gidstr = talloc_asprintf(tc, "%u", (unsigned int)domadmins_gid);
                dir = talloc_sub_specified(tc, lp_template_homedir(),
                                                "Administrator",
                                                get_global_sam_name(),
@@ -1695,8 +1699,8 @@ doma_done:
                sid_compose(&sid, get_global_sam_sid(), DOMAIN_USER_RID_GUEST);
 
                dn = talloc_asprintf(tc, "uid=%s,%s", pwd->pw_name, lp_ldap_user_suffix ());
-               uidstr = talloc_asprintf(tc, "%d", pwd->pw_uid);
-               gidstr = talloc_asprintf(tc, "%d", pwd->pw_gid);
+               uidstr = talloc_asprintf(tc, "%u", (unsigned int)pwd->pw_uid);
+               gidstr = talloc_asprintf(tc, "%u", (unsigned int)pwd->pw_gid);
                if (!dn || !uidstr || !gidstr) {
                        d_fprintf(stderr, "Out of Memory!\n");
                        goto failed;
@@ -1735,7 +1739,7 @@ doma_done:
 
        d_printf("Checking Guest's group.\n");
 
-       pwd = getpwnam_alloc(NULL, lp_guestaccount());
+       pwd = getpwnam_alloc(talloc_autofree_context(), lp_guestaccount());
        if (!pwd) {
                d_fprintf(stderr, "Failed to find just created Guest account!\n"
                                  "   Is nss properly configured?!\n");
@@ -1761,7 +1765,7 @@ doma_done:
                uname = talloc_strdup(tc, "domguests");
                wname = talloc_strdup(tc, "Domain Guests");
                dn = talloc_asprintf(tc, "cn=%s,%s", "domguests", lp_ldap_group_suffix());
-               gidstr = talloc_asprintf(tc, "%d", pwd->pw_gid);
+               gidstr = talloc_asprintf(tc, "%u", (unsigned int)pwd->pw_gid);
                gtype = talloc_asprintf(tc, "%d", SID_NAME_DOM_GRP);
 
                if (!uname || !wname || !dn || !gidstr || !gtype) {