summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2011-02-10 11:04:41 +0100
committerMichael Adam <obnox@samba.org>2011-02-10 13:57:32 +0100
commit1ea1043f8df6ad8b0606ae98a808f4006265a870 (patch)
treef6cd507c53ffe620e880fe8518b0ef4b5477d13d
parent0def826ec5851b88f8adbddd66993d7219a0d74c (diff)
downloadsamba-1ea1043f8df6ad8b0606ae98a808f4006265a870.tar.gz
samba-1ea1043f8df6ad8b0606ae98a808f4006265a870.tar.bz2
samba-1ea1043f8df6ad8b0606ae98a808f4006265a870.zip
Revert "wbinfo: remove --remove-gid-mapping - winbindd does not implement that any more."
This reverts commit 48ad64aa78568c4ce743345448c9d39305752d73. Undo the library version bump.
-rw-r--r--nsswitch/wbinfo.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/nsswitch/wbinfo.c b/nsswitch/wbinfo.c
index a4b2a3c998..9afc166689 100644
--- a/nsswitch/wbinfo.c
+++ b/nsswitch/wbinfo.c
@@ -1040,6 +1040,35 @@ static bool wbinfo_allocate_gid(void)
return true;
}
+static bool wbinfo_remove_gid_mapping(gid_t gid, const char *sid_str)
+{
+ wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
+ struct wbcDomainSid sid;
+
+ /* Send request */
+
+ wbc_status = wbcStringToSid(sid_str, &sid);
+ if (!WBC_ERROR_IS_OK(wbc_status)) {
+ d_fprintf(stderr, "failed to call wbcStringToSid: %s\n",
+ wbcErrorString(wbc_status));
+ return false;
+ }
+
+ wbc_status = wbcRemoveGidMapping(gid, &sid);
+ if (!WBC_ERROR_IS_OK(wbc_status)) {
+ d_fprintf(stderr, "failed to call wbcRemoveGidMapping: %s\n",
+ wbcErrorString(wbc_status));
+ return false;
+ }
+
+ /* Display response */
+
+ d_printf("Removed gid %u to sid %s mapping\n",
+ (unsigned int)gid, sid_str);
+
+ return true;
+}
+
/* Convert sid to string */
static bool wbinfo_lookupsid(const char *sid_str)
@@ -1836,6 +1865,7 @@ enum {
OPT_USERSIDS,
OPT_ALLOCATE_UID,
OPT_ALLOCATE_GID,
+ OPT_REMOVE_GID_MAPPING,
OPT_SEPARATOR,
OPT_LIST_ALL_DOMAINS,
OPT_LIST_OWN_DOMAIN,
@@ -1896,6 +1926,7 @@ int main(int argc, char **argv, char **envp)
"Get a new UID out of idmap" },
{ "allocate-gid", 0, POPT_ARG_NONE, 0, OPT_ALLOCATE_GID,
"Get a new GID out of idmap" },
+ { "remove-gid-mapping", 0, POPT_ARG_STRING, &string_arg, OPT_REMOVE_GID_MAPPING, "Remove gid to sid mapping in idmap", "GID,SID" },
{ "check-secret", 't', POPT_ARG_NONE, 0, 't', "Check shared secret" },
{ "change-secret", 'c', POPT_ARG_NONE, 0, 'c', "Change shared secret" },
{ "ping-dc", 'P', POPT_ARG_NONE, 0, 'P',
@@ -2095,6 +2126,17 @@ int main(int argc, char **argv, char **envp)
goto done;
}
break;
+ case OPT_REMOVE_GID_MAPPING:
+ if (!parse_mapping_arg(string_arg, &int_subarg,
+ &string_subarg) ||
+ !wbinfo_remove_gid_mapping(int_subarg,
+ string_subarg))
+ {
+ d_fprintf(stderr, "Could not remove gid to sid "
+ "mapping\n");
+ goto done;
+ }
+ break;
case 't':
if (!wbinfo_check_secret(opt_domain_name)) {
d_fprintf(stderr, "Could not check secret\n");