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