kadm5_chpass_principal

Changes the principal's password

说明

bool kadm5_chpass_principal ( resource $handle , string $principal , string $password )

kadm5_chpass_principal sets the new password password for the principal.

参数

handle
A KADM5 handle.

principal
The principal.

password
The new password.

返回值

成功时返回 TRUE, 或者在失败时返回 FALSE

范例

示例 #1 Example of changing principal's password

<?php

$handle = kadm5_init_with_password("afs-1", "GONICUS.LOCAL", "admin/admin", "password");

kadm5_chpass_principal($handle, "burbach@GONICUS.LOCAL", "newpassword");

kadm5_destroy($handle);
?>

kadm5_create_principal

Creates a kerberos principal with the given parameters

说明

bool kadm5_create_principal ( resource $handle , string $principal [, string $password [, array $options ]] )

Creates a principal with the given password.

参数

handle
A KADM5 handle.

principal
The principal.

password
If password is omitted or is NULL, a random key will be generated.

options
It is possible to specify several optional parameters within the array options. Allowed are the following options: KADM5_PRINC_EXPIRE_TIME, KADM5_PW_EXPIRATION, KADM5_ATTRIBUTES, KADM5_MAX_LIFE, KADM5_KVNO, KADM5_POLICY, KADM5_CLEARPOLICY, KADM5_MAX_RLIFE.

返回值

成功时返回 TRUE, 或者在失败时返回 FALSE

范例

示例 #1 Example of principal's creation

<?php

$handle = kadm5_init_with_password("afs-1", "GONICUS.LOCAL", "admin/admin", "password");

$attributes = KRB5_KDB_REQUIRES_PRE_AUTH | KRB5_KDB_DISALLOW_PROXIABLE;
$options = array(KADM5_PRINC_EXPIRE_TIME => 0,
                 KADM5_POLICY => "default",
                 KADM5_ATTRIBUTES => $attributes);

kadm5_create_principal($handle, "burbach@GONICUS.LOCAL", "password", $options);

kadm5_destroy($handle);
?>

参见

  • kadm5_modify_principal
  • kadm5_delete_principal

kadm5_delete_principal

Deletes a kerberos principal

说明

bool kadm5_delete_principal ( resource $handle , string $principal )

Removes the principal from the Kerberos database.

参数

handle
A KADM5 handle.

principal
The removed principal.

返回值

成功时返回 TRUE, 或者在失败时返回 FALSE

范例

示例 #1 kadm5_delete_principal example

<?php

$handle = kadm5_init_with_password("afs-1", "GONICUS.LOCAL", "admin/admin", "password");

kadm5_delete_principal($handle, "burbach@GONICUS.LOCAL");

kadm5_destroy($handle);
?>

参见

  • kadm5_modify_principal
  • kadm5_create_principal

kadm5_destroy

Closes the connection to the admin server and releases all related resources

说明

bool kadm5_destroy ( resource $handle )

Closes the connection to the admin server and releases all related resources.

参数

handle
A KADM5 handle.

返回值

成功时返回 TRUE, 或者在失败时返回 FALSE

参见

  • kadm5_init_with_password

kadm5_flush

Flush all changes to the Kerberos database

说明

bool kadm5_flush ( resource $handle )

Flush all changes to the Kerberos database, leaving the connection to the Kerberos admin server open.

参数

handle
A KADM5 handle.

返回值

成功时返回 TRUE, 或者在失败时返回 FALSE

kadm5_get_policies

Gets all policies from the Kerberos database

说明

array kadm5_get_policies ( resource $handle )

Gets an array containing the policies's names.

参数

handle
A KADM5 handle.

返回值

Returns array of policies on success 或者在失败时返回 FALSE.

范例

示例 #1 kadm5_get_policies example

<?php
$handle = kadm5_init_with_password("afs-1", "GONICUS.LOCAL", "admin/admin", "password");

print "<h1>get_policies</h1>\n";
foreach (kadm5_get_policies($handle) as $policy) {
    echo "$policy<br />\n";
}

kadm5_destroy($handle);
?>

kadm5_get_principal

Gets the principal's entries from the Kerberos database

说明

array kadm5_get_principal ( resource $handle , string $principal )

Gets the principal's entries from the Kerberos database.

参数

handle
A KADM5 handle.

principal
The principal.

返回值

Returns array of options containing the following keys: KADM5_PRINCIPAL, KADM5_PRINC_EXPIRE_TIME, KADM5_PW_EXPIRATION, KADM5_ATTRIBUTES, KADM5_MAX_LIFE, KADM5_MOD_NAME, KADM5_MOD_TIME, KADM5_KVNO, KADM5_POLICY, KADM5_MAX_RLIFE, KADM5_LAST_SUCCESS, KADM5_LAST_FAILED, KADM5_FAIL_AUTH_COUNT on success 或者在失败时返回 FALSE.

范例

示例 #1 kadm5_get_principal example

<?php
$handle = kadm5_init_with_password("afs-1", "GONICUS.LOCAL", "admin/admin", "password");

print "<h1>get_principal burbach@GONICUS.LOCAL</h1>\n";

$options = kadm5_get_principal($handle, "burbach@GONICUS.LOCAL" );

foreach ($options as $key => $value) {
    echo "$key: $value<br />\n";
}

kadm5_destroy($handle);
?>

参见

  • kadm5_get_principals

kadm5_get_principals

Gets all principals from the Kerberos database

说明

array kadm5_get_principals ( resource $handle )

kadm5_get_principals returns an array containing the principals's names.

参数

handle
A KADM5 handle.

返回值

Returns array of principals on success 或者在失败时返回 FALSE.

范例

示例 #1 kadm5_get_principals example

<?php
$handle = kadm5_init_with_password("afs-1", "GONICUS.LOCAL", "admin/admin", "password");

print "<h1>get_principals</h1>\n";
foreach (kadm5_get_principals($handle) as $principal) {
    echo "$principal<br />\n";
}

kadm5_destroy($handle);
?>

参见

  • kadm5_get_principal

kadm5_init_with_password

Opens a connection to the KADM5 library

说明

resource kadm5_init_with_password ( string $admin_server , string $realm , string $principal , string $password )

Opens a connection with the KADM5 library using the principal and the given password to obtain initial credentials from the admin_server.

参数

admin_server
The server.

realm
Defines the authentication domain for the connection.

principal
The principal.

password
If password is omitted or is NULL, a random key will be generated.

返回值

Returns a KADM5 handle on success 或者在失败时返回 FALSE.

范例

示例 #1 KADM5 initialization example

<?php

$handle = kadm5_init_with_password("afs-1", "GONICUS.LOCAL", "admin/admin", "password");

$attributes = KRB5_KDB_REQUIRES_PRE_AUTH | KRB5_KDB_DISALLOW_PROXIABLE;
$options = array(KADM5_PRINC_EXPIRE_TIME => 0,
                 KADM5_POLICY => "default",
                 KADM5_ATTRIBUTES => $attributes);

kadm5_create_principal($handle, "burbach@GONICUS.LOCAL", "password", $options);

kadm5_destroy($handle);
?>

注释

Note:

Connection should be closed after use with class="function">kadm5_destroy.

参见

  • kadm5_destroy

kadm5_modify_principal

Modifies a kerberos principal with the given parameters

说明

bool kadm5_modify_principal ( resource $handle , string $principal , array $options )

Modifies a principal according to the given options.

参数

handle
A KADM5 handle.

principal
The principal.

options
It is possible to specify several optional parameters within the array options. Allowed are the following options: KADM5_PRINC_EXPIRE_TIME, KADM5_PW_EXPIRATION, KADM5_ATTRIBUTES, KADM5_MAX_LIFE, KADM5_KVNO, KADM5_POLICY, KADM5_CLEARPOLICY, KADM5_MAX_RLIFE. KADM5_FAIL_AUTH_COUNT.

返回值

成功时返回 TRUE, 或者在失败时返回 FALSE

范例

示例 #1 Example of modifying principal

<?php

$handle = kadm5_init_with_password("afs-1", "GONICUS.LOCAL", "admin/admin", "password");

$attributes = KRB5_KDB_REQUIRES_PRE_AUTH;
$options = array(KADM5_PRINC_EXPIRE_TIME => 3451234,
                 KADM5_POLICY => "gonicus",
                 KADM5_ATTRIBUTES => $attributes);

kadm5_modify_principal($handle, "burbach@GONICUS.LOCAL", $options);

kadm5_destroy($handle);
?>

参见

  • kadm5_create_principal
  • kadm5_delete_principal

目录