我使用ldap_modify与OpenLDAP 2.4.32和PHP 5.4.6获得的访问错误不足.
给出错误的php函数如下所示:
function set_user($dn, $password, $data)
{
/* This function sets the users infomation */
// Get Configuration Items
$ldapServer = $this->config->item('ldapServer');
$ldapDCRoot = $this->config->item('ldapDCRoot');
// Connect to LDAP
$ldapConnection = ldap_connect($ldapServer);
if($ldapConnection)
{
$r = ldap_bind($ldapConnection, $dn, $password);
if ($r)
{
// Bind completed successfully
$r = ldap_modify($ldapConnection, $dn, $data);
return True;
}
die("Unsuccessful Bind");
}
die("Can't connect to LDAP");
}
Run Code Online (Sandbox Code Playgroud)
$ dn是用户尝试更改其信息及密码的完整DN.$ data是他们正在更新的值,现在数据只包含要更改$ data ['mobile'] ="newPhoneNumber"的电话号码.除了实际上从未实际写入数据之外,这一切似乎都有效.
openldap文件包含在下面,因为您可以看到ACL说我应该可以写入它.
include /etc/openldap/schema/corba.schema
include /etc/openldap/schema/core.schema
include /etc/openldap/schema/cosine.schema
include /etc/openldap/schema/duaconf.schema
include …Run Code Online (Sandbox Code Playgroud) 我想找到一种让PHP加密文件的方法.我曾经只是使用PHP系统调用来运行编码该文件的脚本:
#!/bin/sh
/usr/bin/openssl aes-256-cbc -a -salt -k $1 -in $2
Run Code Online (Sandbox Code Playgroud)
参数1是要使用的密码,参数2是数据.然后,我在计算机上使用第二个脚本来解密文件.
#!/bin/sh
/usr/bin/openssl aes-256-cbc -a -d -salt -k $1 -in $2
Run Code Online (Sandbox Code Playgroud)
由于禁用了PHP系统调用,因此这种加密方法无法在生产主机上运行.如果可能的话,我也不希望改变解码功能.
有没有办法只使用PHP复制上面的加密函数?