1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
|
diff -Nur source/utils/net.c source/utils/net.c
--- source/utils/net.c Fri Sep 27 09:42:34 2002
+++ source/utils/net.c Tue Oct 1 12:22:00 2002
@@ -68,6 +68,7 @@
int opt_port = 0;
int opt_maxusers = -1;
char *opt_comment = "";
+char *opt_container = "cn=Users";
int opt_flags = -1;
int opt_jobid = 0;
int opt_timeout = 0;
@@ -459,6 +460,7 @@
{"myname", 'n', POPT_ARG_STRING, &opt_requester_name},
{"conf", 's', POPT_ARG_STRING, &servicesf},
{"server", 'S', POPT_ARG_STRING, &opt_host},
+ {"container", 'c', POPT_ARG_STRING, &opt_container},
{"comment", 'C', POPT_ARG_STRING, &opt_comment},
{"maxusers", 'M', POPT_ARG_INT, &opt_maxusers},
{"flags", 'F', POPT_ARG_INT, &opt_flags},
diff -Nur source/utils/net.h source/utils/net.h
--- source/utils/net.h Tue Jun 25 04:29:09 2002
+++ source/utils/net.h Tue Oct 1 12:19:51 2002
@@ -38,10 +38,8 @@
extern int opt_maxusers;
extern char *opt_comment;
+extern char *opt_container;
extern int opt_flags;
-
-extern char *opt_comment;
-
extern char *opt_target_workgroup;
extern int opt_long_list_entries;
extern int opt_reboot;
diff -Nur source/utils/net_ads.c source/utils/net_ads.c
--- source/utils/net_ads.c Tue Sep 17 14:15:52 2002
+++ source/utils/net_ads.c Tue Oct 1 12:33:44 2002
@@ -255,7 +255,7 @@
goto done;
}
- status = ads_add_user_acct(ads, argv[0], opt_comment);
+ status = ads_add_user_acct(ads, argv[0], opt_container, opt_comment);
if (!ADS_ERR_OK(status)) {
d_printf("Could not add user %s: %s\n", argv[0],
@@ -431,7 +431,7 @@
goto done;
}
- status = ads_add_group_acct(ads, argv[0], opt_comment);
+ status = ads_add_group_acct(ads, argv[0], opt_container, opt_comment);
if (ADS_ERR_OK(status)) {
d_printf("Group %s added\n", argv[0]);
diff -Nur source/utils/net_help.c source/utils/net_help.c
--- source/utils/net_help.c Tue Sep 24 20:10:30 2002
+++ source/utils/net_help.c Tue Oct 1 13:01:50 2002
@@ -69,14 +69,14 @@
"\n\tDelete specified user\n");
d_printf("\nnet [<method>] user INFO <name> [misc. options] [targets]"\
"\n\tList the domain groups of the specified user\n");
- d_printf("\nnet [<method>] user ADD <name> [password] "\
+ d_printf("\nnet [<method>] user ADD <name> [password] [-c container] "\
"[-F user flags] [misc. options]"\
" [targets]\n\tAdd specified user\n");
net_common_methods_usage(argc, argv);
net_common_flags_usage(argc, argv);
- d_printf(
- "\t-C or --comment=<comment>\tdescriptive comment (for add only)\n");
+ d_printf("\t-C or --comment=<comment>\tdescriptive comment (for add only)\n");
+ d_printf("\t-c or --container=<container>\tLDAP container, defaults to cn=Users (for add in ADS only)\n");
return -1;
}
@@ -85,12 +85,12 @@
"\n\tList user groups\n\n");
d_printf("net [<method>] group DELETE <name> [misc. options] [targets]"\
"\n\tDelete specified group\n");
- d_printf("\nnet [<method>] group ADD <name> [-C comment]"\
+ d_printf("\nnet [<method>] group ADD <name> [-C comment] [-c container]"\
" [misc. options] [targets]\n\tCreate specified group\n");
net_common_methods_usage(argc, argv);
net_common_flags_usage(argc, argv);
- d_printf(
- "\t-C or --comment=<comment>\tdescriptive comment (for add only)\n");
+ d_printf("\t-C or --comment=<comment>\tdescriptive comment (for add only)\n");
+ d_printf("\t-c or --container=<container>\tLDAP container, defaults to cn=Users (for add in ADS only)\n");
return -1;
}
diff -Nur source/libads/ldap_user.c source/libads/ldap_user.c
--- source/libads/ldap_user.c Wed Aug 7 12:33:22 2002
+++ source/libads/ldap_user.c Tue Oct 1 12:46:08 2002
@@ -38,7 +38,7 @@
}
ADS_STATUS ads_add_user_acct(ADS_STRUCT *ads, const char *user,
- const char *fullname)
+ const char *container, const char *fullname)
{
TALLOC_CTX *ctx;
ADS_MODLIST mods;
@@ -57,7 +60,7 @@
if (!(upn = talloc_asprintf(ctx, "%s@%s", user, ads->config.realm)))
goto done;
- if (!(new_dn = talloc_asprintf(ctx, "cn=%s,cn=Users,%s", name,
+ if (!(new_dn = talloc_asprintf(ctx, "cn=%s,%s,%s", name, container,
ads->config.bind_path)))
goto done;
if (!(controlstr = talloc_asprintf(ctx, "%u", UF_NORMAL_ACCOUNT)))
@@ -80,7 +83,7 @@
}
ADS_STATUS ads_add_group_acct(ADS_STRUCT *ads, const char *group,
- const char *comment)
+ const char *container, const char *comment)
{
TALLOC_CTX *ctx;
ADS_MODLIST mods;
@@ -93,7 +96,7 @@
status = ADS_ERROR(LDAP_NO_MEMORY);
- if (!(new_dn = talloc_asprintf(ctx, "cn=%s,cn=Users,%s", group,
+ if (!(new_dn = talloc_asprintf(ctx, "cn=%s,%s,%s", group, container,
ads->config.bind_path)))
goto done;
if (!(mods = ads_init_mods(ctx)))
@@ -102,7 +105,7 @@
ads_mod_str(ctx, &mods, "cn", group);
ads_mod_strlist(ctx, &mods, "objectClass",objectClass);
ads_mod_str(ctx, &mods, "name", group);
- if (comment)
+ if (comment && *comment)
ads_mod_str(ctx, &mods, "description", comment);
ads_mod_str(ctx, &mods, "sAMAccountName", group);
status = ads_gen_add(ads, new_dn, mods);
|