summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Lendecke <vlendec@samba.org>2007-01-10 15:31:42 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:17:01 -0500
commitb5e262dbd06a2b0f582dc3da59dba05c4e4312cf (patch)
tree6293df43ec8f6ea5cd81e0f94b007d7579b49fd1
parent062a1a4904b58f17b4917677fad780d69b7c4f69 (diff)
downloadsamba-b5e262dbd06a2b0f582dc3da59dba05c4e4312cf.tar.gz
samba-b5e262dbd06a2b0f582dc3da59dba05c4e4312cf.tar.bz2
samba-b5e262dbd06a2b0f582dc3da59dba05c4e4312cf.zip
r20654: Fix from Karolin Seeger <ks@sernet.de>: Accept "forever", "off" and "never" as
key words for -1 as policy values for net sam policy. Volker (This used to be commit b6347751d8f67dcaac5c1bcbc07f03073278f6fb)
-rw-r--r--source3/utils/net_sam.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/source3/utils/net_sam.c b/source3/utils/net_sam.c
index 2c9b9649f7..8800cb3606 100644
--- a/source3/utils/net_sam.c
+++ b/source3/utils/net_sam.c
@@ -375,7 +375,21 @@ static int net_sam_policy_set(int argc, const char **argv)
account_policy = argv[0];
field = account_policy_name_to_fieldnum(account_policy);
- value = strtoul(argv[1], &endptr, 10);
+
+ if (strequal(argv[1], "forever") || strequal(argv[1], "never")
+ || strequal(argv[1], "off")) {
+ value = -1;
+ }
+ else {
+ value = strtoul(argv[1], &endptr, 10);
+
+ if ((endptr == argv[1]) || (endptr[0] != '\0')) {
+ d_printf("Unable to set policy \"%s\"! Invalid value "
+ "\"%s\".\n",
+ account_policy, argv[1]);
+ return -1;
+ }
+ }
if (field == 0) {
const char **names;
@@ -398,12 +412,6 @@ static int net_sam_policy_set(int argc, const char **argv)
"value!\n");
}
- if ((endptr == argv[1]) || (endptr[0] != '\0')) {
- d_printf("Unable to set policy \"%s\"! Invalid value %s.\n",
- account_policy, argv[1]);
- return -1;
- }
-
if (!pdb_set_account_policy(field, value)) {
d_fprintf(stderr, "Valid account policy, but unable to "
"set value!\n");