From: cajus Date: Thu, 16 Nov 2006 05:23:50 +0000 (+0000) Subject: Enabled removal from kerberos database, if user gets removed X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=961e1bb9813d66d1f1bf98163cbb1e0518ae8379;p=gosa.git Enabled removal from kerberos database, if user gets removed git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@5132 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/plugins/personal/generic/class_user.inc b/plugins/personal/generic/class_user.inc index c0492073a..803f6ce57 100644 --- a/plugins/personal/generic/class_user.inc +++ b/plugins/personal/generic/class_user.inc @@ -580,6 +580,41 @@ class user extends plugin $og->save (); } + /* Kerberos server defined? */ + if (isset($this->config->data['SERVERS']['KERBEROS'])){ + $cfg= $this->config->data['SERVERS']['KERBEROS']; + } + if (isset($cfg['SERVER']) && function_exists('kadm5_init_with_password')){ + + /* Connect to the admin interface */ + $handle = kadm5_init_with_password($cfg['SERVER'], $cfg['REALM'], + $cfg['ADMIN'], $cfg['PASSWORD']); + + /* Errors? */ + if ($handle === FALSE){ + print_red (_("Kerberos database communication failed")); + return (2); + } + + /* Build user principal, get list of existsing principals */ + $principal= $this->uid."@".$cfg['REALM']; + $principals = kadm5_get_principals($handle); + + /* User exists in database? */ + if (in_array($principal, $principals)){ + + /* Ok. User exists. Remove him/her */ + $ret= kadm5_delete_principal ( $handle, $principal); + if ($ret === FALSE){ + print_red (_("Can't remove user from kerberos database.")); + } + } + + /* Free kerberos admin handle */ + kadm5_destroy($handle); + } + + /* Optionally execute a command after we're done */ $this->handle_post_events("remove",array("uid" => $this->uid)); }