|
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) |