Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When creating user from template, multiple Domain FullName and Mail are not propagated #4768

Closed
dk-dksoft opened this issue May 11, 2022 · 1 comment
Labels
bug Undesired behaviour confirmed Bug is confirm by dev team resolved A fixed issue
Milestone

Comments

@dk-dksoft
Copy link

dk-dksoft commented May 11, 2022

Describe the bug

Full Name and mail are not propagated to user profile when new user is connecting to cacti thru AD credentials in Multiple AD LDAP mode (creating user from template user)

To Reproduce

Steps to reproduce the behavior:

  1. Configure Multiple AD LDAP domain with MS Active Directory
    Domains Type Active Directory
    User Template AD-user-temp
    Protocol Version 3
    Encryption SSL
    Mode Specific Searching
    Require Group Membership ON

LDAP CN Settings
Full Name cn
eMail mail

  1. Login with new user credentials (user must be in the required AD user group)

  2. Go to Console -> Configuration -> users .

  3. There will be no Fullname and email in user properties.

Expected behavior

Full Name and mail must be propagated from Active Directory.

Desktop (please complete the following information)

I have made this change to code, it resolves the issue:

@cacti:/usr/share/cacti/site# diff auth_login_old.php auth_login.php 
527c527,528
<                                                       $ldap_cn_search_response = cacti_ldap_search_cn($username, array($cn_full_name,$cn_email) );
---
>                                               #       $ldap_cn_search_response = cacti_ldap_search_cn($username, array($cn_full_name,$cn_email) );
>                                                       $ldap_cn_search_response = domain_ldappp_search_cn($username, array($cn_full_name,$cn_email),get_nfilter_request_var('realm')-1000);
622a624,671
> }
> 
> 
> function domain_ldappp_search_cn($username, $cn = array(), $realm) {
> 
>         $ldap = new Ldap;
>       
> 
>  if (!empty($username)) $ldap->username = $username;
> 
>         $ld = db_fetch_row_prepared('SELECT *
>                 FROM user_domains_ldap
>                 WHERE domain_id = 1',
>                 array($realm-1000));
> 
>         if (cacti_sizeof($ld)) {
>                 if (!empty($ld['dn']))                $ldap->dn                = $ld['dn'];
>                 if (!empty($ld['server']))            $ldap->host              = $ld['server'];
>                 if (!empty($ld['port']))              $ldap->port              = $ld['port'];
>                 if (!empty($ld['port_ssl']))          $ldap->port_ssl          = $ld['port_ssl'];
>                 if (!empty($ld['proto_version']))     $ldap->version           = $ld['proto_version'];
>                 if (!empty($ld['encryption']))        $ldap->encryption        = $ld['encryption'];
>                 if (!empty($ld['referrals']))         $ldap->referrals         = $ld['referrals'];
> 
>                 if (!empty($ld['mode']))              $ldap->mode              = 2;
>                 if (!empty($ld['search_base']))       $ldap->search_base       = $ld['search_base'];
>                 if (!empty($ld['search_filter']))     $ldap->search_filter     = $ld['search_filter'];
>                 if (!empty($ld['specific_dn']))       $ldap->specific_dn       = $ld['specific_dn'];
>                 if (!empty($ld['specific_password'])) $ldap->specific_password = $ld['specific_password'];
> 
>                 if ($ld['group_require'] == 'on') {
>                         $ldap->group_require = true;
>                 } else {
>                         $ldap->group_require = false;
>                 }
> 
> 
> 
>                 if (!empty($ld['group_dn']))          $ldap->group_dn          = $ld['group_dn'];
>                 if (!empty($ld['group_attrib']))      $ldap->group_attrib      = $ld['group_attrib'];
>                 if (!empty($ld['group_member_type'])) $ldap->group_member_type = $ld['group_member_type'];
>               }
> 
>         if (!empty($cn))                $ldap->cn                = $cn;
> 
> 
> 
>         return $ldap->Getcn();
@dk-dksoft dk-dksoft added bug Undesired behaviour unverified Some days we don't have a clue labels May 11, 2022
@TheWitness TheWitness added confirmed Bug is confirm by dev team and removed unverified Some days we don't have a clue labels May 12, 2022
@TheWitness
Copy link
Member

I reviewed your pull request. There are some typo's the biggest one being that you mis-spelled the function call in auth_login.php. Take a read. I'll leave it to @netniV 's discretion on whether or not it makes it into 1.2.21 or 1.2.22.

TheWitness added a commit that referenced this issue Jun 11, 2022
@TheWitness TheWitness added this to the v1.2.22 milestone Jun 11, 2022
@TheWitness TheWitness added the resolved A fixed issue label Jun 11, 2022
@netniV netniV changed the title Cacti 1.2.16 Multiple AD LDAP Full Name and mail are not propagated when creating user from template When creating user from template, multiple Domain FullName and Mail are not propagated Aug 14, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Nov 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Undesired behaviour confirmed Bug is confirm by dev team resolved A fixed issue
Projects
None yet
Development

No branches or pull requests

2 participants