pedro456789 Posted May 17, 2022 Share Posted May 17, 2022 Olá pessoal, Estou tentando obter alguns valores do meu Active Directory através do "ldap_get_entries", a conexão está funcional e consigo obter vários atributos, porém o atributo "ms-Mcs-AdmPwd" sempre retorna em branco mesmo estando populado no Active Directory. Já tentei inclusive colocar as credenciais de administrador do domínio para validar as permissões e mesmo assim só tenho retorno do atributo "name". Outros atributos como cn retornam OK, porém atributos operatingSystem e sAMAccountName também não retornam mesmo que sejam inclusos no filtro $justthese. <?php $ldap_columns = NULL; $ldap_connection = NULL; $ldap_password = 'password'; $ldap_username = 'user@XYZ.com.br'; $ldap_server = 'ldaps://XYZ.com.br'; $ldap_connection = ldap_connect($ldap_server); if (FALSE === $ldap_connection){ die("<p>Failed to connect to the LDAP server: ". $ldap_server ."</p>"); } ldap_set_option($ldap_connection, LDAP_OPT_PROTOCOL_VERSION, 3) or die('Unable to set LDAP protocol version'); ldap_set_option($ldap_connection, LDAP_OPT_REFERRALS, 0); if (TRUE === ldap_bind($ldap_connection, $ldap_username, $ldap_password)){ $justthese = array('name','ms-Mcs-AdmPwd'); $result = ldap_search($ldap_connection, "DC=XYZ,DC=com,dc=br", "(&(objectClass=Computer)(name=ABCD))", $justthese); $info = ldap_get_entries($ldap_connection, $result) or die ("Erro!"); echo $info[0]["ms-Mcs-AdmPwd"][0]; if ($info[0]["name"][0] != ''){ echo $info[0]["name"][0]; } } ?> Se alguém puder ajudar agradeço muito. Quote Link to comment https://forums.phpfreaks.com/topic/314806-ldap_get_entries-n%C3%A3o-retorna-1-dos-atributos/ Share on other sites More sharing options...
gw1500se Posted May 17, 2022 Share Posted May 17, 2022 Este es un foro en inglés. Quote Link to comment https://forums.phpfreaks.com/topic/314806-ldap_get_entries-n%C3%A3o-retorna-1-dos-atributos/#findComment-1596372 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.