mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-15 16:38:54 +00:00
174 lines
4.8 KiB
XML
174 lines
4.8 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision$ -->
|
|
<refentry xml:id="function.ldap-exop-passwd" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
<refnamediv>
|
|
<refname>ldap_exop_passwd</refname>
|
|
<refpurpose>PASSWD extended operation helper</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<type class="union"><type>string</type><type>bool</type></type><methodname>ldap_exop_passwd</methodname>
|
|
<methodparam><type>resource</type><parameter>ldap</parameter></methodparam>
|
|
<methodparam choice="opt"><type>string</type><parameter>user</parameter><initializer>""</initializer></methodparam>
|
|
<methodparam choice="opt"><type>string</type><parameter>old_password</parameter><initializer>""</initializer></methodparam>
|
|
<methodparam choice="opt"><type>string</type><parameter>new_password</parameter><initializer>""</initializer></methodparam>
|
|
<methodparam choice="opt"><type>array</type><parameter role="reference">controls</parameter><initializer>&null;</initializer></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Performs a PASSWD extended operation.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>ldap</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
&ldap.parameter.ldap;
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>user</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
dn of the user to change the password of.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>old_password</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
The old password of this user. May be ommited depending of server configuration.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>new_password</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
The new password for this user. May be omitted or empty to have a generated password.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>controls</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
If provided, a password policy request control is send with the request and this is
|
|
filled with an array of <link linkend="ldap.controls">LDAP Controls</link>
|
|
returned with the request.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
Returns the generated password if <parameter>new_password</parameter> is empty or omitted.
|
|
Otherwise returns &true; on success and &false; on failure.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="changelog">
|
|
&reftitle.changelog;
|
|
<para>
|
|
<informaltable>
|
|
<tgroup cols="2">
|
|
<thead>
|
|
<row>
|
|
<entry>&Version;</entry>
|
|
<entry>&Description;</entry>
|
|
</row>
|
|
</thead>
|
|
<tbody>
|
|
&ldap.changelog.controls-nullable;
|
|
<row>
|
|
<entry>7.3</entry>
|
|
<entry>
|
|
Support for <parameter>controls</parameter> added
|
|
</entry>
|
|
</row>
|
|
</tbody>
|
|
</tgroup>
|
|
</informaltable>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
<example>
|
|
<title>PASSWD extended operation</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$ds = ldap_connect("localhost"); // assuming the LDAP server is on this host
|
|
|
|
if ($ds) {
|
|
// bind with appropriate dn to give update access
|
|
$bind = ldap_bind($ds, "cn=root, o=My Company, c=US", "secret");
|
|
if (!$bind) {
|
|
echo "Unable to bind to LDAP server";
|
|
exit;
|
|
}
|
|
|
|
// use PASSWD EXOP to change the user password for a generated one
|
|
$genpw = ldap_exop_passwd($ds, "cn=root, o=My Company, c=US", "secret");
|
|
if ($genpw) {
|
|
// use the generated password to bind
|
|
$bind = ldap_bind($ds, "cn=root, o=My Company, c=US", $genpw);
|
|
}
|
|
|
|
// set the password back to "secret"
|
|
ldap_exop_passwd($ds, "cn=root, o=My Company, c=US", $genpw, "secret");
|
|
|
|
ldap_close($ds);
|
|
} else {
|
|
echo "Unable to connect to LDAP server";
|
|
}
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="seealso">
|
|
&reftitle.seealso;
|
|
<para>
|
|
<simplelist>
|
|
<member><function>ldap_exop</function></member>
|
|
<member><function>ldap_parse_exop</function></member>
|
|
</simplelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
</refentry>
|
|
<!-- Keep this comment at the end of the file
|
|
Local variables:
|
|
mode: sgml
|
|
sgml-omittag:t
|
|
sgml-shorttag:t
|
|
sgml-minimize-attributes:nil
|
|
sgml-always-quote-attributes:t
|
|
sgml-indent-step:1
|
|
sgml-indent-data:t
|
|
indent-tabs-mode:nil
|
|
sgml-parent-document:nil
|
|
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
|
|
sgml-exposed-tags:nil
|
|
sgml-local-catalogs:nil
|
|
sgml-local-ecat-files:nil
|
|
End:
|
|
vim600: syn=xml fen fdm=syntax fdl=2 si
|
|
vim: et tw=78 syn=sgml
|
|
vi: ts=1 sw=1
|
|
-->
|