View | Details | Raw Unified | Return to bug 431685
Collapse All | Expand All

(-)cmdline.ycp (-9 / +10 lines)
Lines 26-38 Link Here
26
/**
26
/**
27
 * set LDAP admin password and read LDAP users and groups
27
 * set LDAP admin password and read LDAP users and groups
28
 */
28
 */
29
define boolean bind_and_read_LDAP (string pw) {
29
define boolean bind_and_read_LDAP (map<string,any> options) {
30
30
31
    string pw	= options["ldap_password"]:"";
31
    if (Users::LDAPAvailable() && Users::LDAPNotRead())
32
    if (Users::LDAPAvailable() && Users::LDAPNotRead())
32
    {
33
    {
33
	if (Ldap::bind_pass == nil)
34
	if (Ldap::bind_pass == nil)
34
	{
35
	{
35
	    if (pw == "")
36
	    if (pw == "" && !haskey (options, "batchmode"))
36
	    {
37
	    {
37
		// password entering label
38
		// password entering label
38
		pw = CommandLine::PasswordInput (_("LDAP Server Password:"));
39
		pw = CommandLine::PasswordInput (_("LDAP Server Password:"));
Lines 253-259 Link Here
253
    string type = user["type"]:"local";
254
    string type = user["type"]:"local";
254
    if (type == "ldap")
255
    if (type == "ldap")
255
    {
256
    {
256
	if (!bind_and_read_LDAP (options["ldap_password"]:""))
257
	if (!bind_and_read_LDAP (options))
257
	    return false;
258
	    return false;
258
	if (!haskey (user,"sn"))
259
	if (!haskey (user,"sn"))
259
	    user["sn"] = user["uid"]:"";
260
	    user["sn"] = user["uid"]:"";
Lines 261-267 Link Here
261
262
262
    Users::ResetCurrentUser ();
263
    Users::ResetCurrentUser ();
263
264
264
    if (!haskey(user,"userPassword"))
265
    if (!haskey(user,"userPassword") && !haskey (user, "batchmode"))
265
    {
266
    {
266
	string pw	= "";
267
	string pw	= "";
267
	integer i	= 0;
268
	integer i	= 0;
Lines 335-341 Link Here
335
    string type = options["type"]:"local";
336
    string type = options["type"]:"local";
336
    if (type == "ldap")
337
    if (type == "ldap")
337
    {
338
    {
338
	if (!bind_and_read_LDAP (options["ldap_password"]:""))
339
	if (!bind_and_read_LDAP (options))
339
	    return false;
340
	    return false;
340
    }
341
    }
341
    if (uid != -1 && uid != nil)
342
    if (uid != -1 && uid != nil)
Lines 382-388 Link Here
382
    string type = options["type"]:"local";
383
    string type = options["type"]:"local";
383
    if (type == "ldap")
384
    if (type == "ldap")
384
    {
385
    {
385
	if (!bind_and_read_LDAP (options["ldap_password"]:""))
386
	if (!bind_and_read_LDAP (options))
386
	    return false;
387
	    return false;
387
    }
388
    }
388
    if (uid != -1 && uid != nil)
389
    if (uid != -1 && uid != nil)
Lines 554-560 Link Here
554
    string type = options["type"]:"local";
555
    string type = options["type"]:"local";
555
    if (type == "ldap")
556
    if (type == "ldap")
556
    {
557
    {
557
	if (!bind_and_read_LDAP (options["ldap_password"]:""))
558
	if (!bind_and_read_LDAP (options))
558
	    return false;
559
	    return false;
559
    }
560
    }
560
    if (gid != -1 && gid != nil)
561
    if (gid != -1 && gid != nil)
Lines 591-597 Link Here
591
    string type = group["type"]:"local";
592
    string type = group["type"]:"local";
592
    if (type == "ldap")
593
    if (type == "ldap")
593
    {
594
    {
594
	if (!bind_and_read_LDAP (options["ldap_password"]:""))
595
	if (!bind_and_read_LDAP (options))
595
	    return false;
596
	    return false;
596
    }
597
    }
597
    string member_attr	= (type == "ldap") ? UsersLDAP::GetMemberAttribute () :
598
    string member_attr	= (type == "ldap") ? UsersLDAP::GetMemberAttribute () :
Lines 644-650 Link Here
644
    string type = options["type"]:"local";
645
    string type = options["type"]:"local";
645
    if (type == "ldap")
646
    if (type == "ldap")
646
    {
647
    {
647
	if (!bind_and_read_LDAP (options["ldap_password"]:""))
648
	if (!bind_and_read_LDAP (options))
648
	    return false;
649
	    return false;
649
    }
650
    }
650
    if (gid != -1 && gid != nil)
651
    if (gid != -1 && gid != nil)
(-)users.ycp (-3 / +15 lines)
Lines 194-206 Link Here
194
	    "help"	: _("New UID of the user"),
194
	    "help"	: _("New UID of the user"),
195
	    "type"	: "string"
195
	    "type"	: "string"
196
	],
196
	],
197
	"batchmode"	:$[
198
	    // translators: command line help text for batchmode option
199
	    "help"	: _("Don't ask for missing data; return error instead.")
200
	],
197
    ],
201
    ],
198
    "mappings"		: $[
202
    "mappings"		: $[
199
	"list"	: [ "local", "system", "ldap", "nis", ],// + "custom"
203
	"list"	: [ "local", "system", "ldap", "nis", ],// + "custom"
200
	"show"  : [ "uid", "username", "type" ],
204
	"show"  : [ "uid", "username", "type" ],
201
	"add"	: [ "username", "uid", "cn", "password", "home", "no_home", "shell", "gid", "grouplist", "type", "ldap_password" ],
205
	"add"	: [ "username", "uid", "cn", "password", "home", "no_home",
202
	"edit"	: [ "username", "uid", "cn", "password", "home", "shell", "gid", "grouplist", "new_username", "new_uid", "type", "ldap_password" ],
206
		    "shell", "gid", "grouplist", "type", "ldap_password",
203
	"delete": [ "username", "uid", "delete_home", "type", "ldap_password" ],
207
		    "batchmode"
208
	],
209
	"edit"	: [ "username", "uid", "cn", "password", "home", "shell", "gid",
210
		    "grouplist", "new_username", "new_uid", "type",
211
		    "ldap_password", "batchmode"
212
	],
213
	"delete": [ "username", "uid", "delete_home", "type", "ldap_password",
214
		    "batchmode"
215
	],
204
    ]
216
    ]
205
];
217
];
206
218
(-)groups.ycp (+4 lines)
Lines 172-177 Link Here
172
	    "help"	: _("Password for LDAP server"),
172
	    "help"	: _("Password for LDAP server"),
173
	    "type"	: "string"
173
	    "type"	: "string"
174
	],
174
	],
175
	"batchmode"	:$[
176
	    // translators: command line help text for batchmode option
177
	    "help"	: _("Don't ask for missing data; return error instead.")
178
	],
175
    ],
179
    ],
176
    "mappings"		: $[
180
    "mappings"		: $[
177
	"list"	: [ "local", "system", "ldap", "nis" ],// + "custom"
181
	"list"	: [ "local", "system", "ldap", "nis" ],// + "custom"

Return to bug 431685