Revision 0914b6bb
Added by Ermal LUÇI about 15 years ago
etc/inc/auth.inc | ||
---|---|---|
340 | 340 |
|
341 | 341 |
if($debug) |
342 | 342 |
log_error("Running: {$cmd}"); |
343 |
$fd = popen($cmd, "w"); |
|
344 |
fwrite($fd, $user['password']); |
|
345 |
pclose($fd); |
|
343 |
mwexec($cmd); |
|
346 | 344 |
|
345 |
/* Delete user from groups needs a call to write_config() */ |
|
346 |
local_group_del_user($user); |
|
347 | 347 |
} |
348 | 348 |
|
349 | 349 |
function local_user_set_password(& $user, $password) { |
... | ... | |
421 | 421 |
local_group_set($group); |
422 | 422 |
} |
423 | 423 |
|
424 |
function local_group_del_user($user) { |
|
425 |
global $config; |
|
426 |
|
|
427 |
if (!is_array($config['system']['group'])) |
|
428 |
return; |
|
429 |
|
|
430 |
foreach ($config['system']['group'] as $group) { |
|
431 |
if (is_array($group['member'])) { |
|
432 |
foreach ($group['member'] as $idx => $uid) { |
|
433 |
if ($user['uid'] == $uid) |
|
434 |
unset($config['system']['group']['member'][$idx]); |
|
435 |
} |
|
436 |
} |
|
437 |
} |
|
438 |
} |
|
439 |
|
|
424 | 440 |
function local_group_set($group, $reset = false) { |
425 | 441 |
global $debug; |
426 | 442 |
|
... | ... | |
446 | 462 |
|
447 | 463 |
if($debug) |
448 | 464 |
log_error("Running: {$cmd}"); |
449 |
$fd = popen($cmd, "w"); |
|
450 |
fwrite($fd, $user['password']); |
|
451 |
pclose($fd); |
|
465 |
mwexec($cmd); |
|
452 | 466 |
|
453 | 467 |
} |
454 | 468 |
|
... | ... | |
460 | 474 |
|
461 | 475 |
if($debug) |
462 | 476 |
log_error("Running: {$cmd}"); |
463 |
$fd = popen($cmd, "w"); |
|
464 |
fwrite($fd, $user['password']); |
|
465 |
pclose($fd); |
|
466 |
|
|
477 |
mwexec($cmd); |
|
467 | 478 |
} |
468 | 479 |
|
469 | 480 |
function ldap_test_connection($authcfg) { |
Also available in: Unified diff
Use mwexec where it does not make sense to use popen for something that does not take any parameters. Create a function to actually remove a user from its groups when the user itself is deleted.