Page MenuHome GnuPG

Kleopatra: Take windows user email Address from Active Directory if available
Open, WishlistPublic

Description

Some customers have the problem that the NameUserPrincipal we query over GetUserNameEx does not match the real email address of the user. We are currently using GetUserNameEx to avoid a full LDAP / AD Search of properties but that would be the better solution.

In Powershell it could be queried like this:
$([adsisearcher]"(samaccountname=$env:USERNAME)").FindOne().Properties.mail

We could of course do such a search using LDAP API ourself and if we find such a property prefer this over the GetUserNameEx value. This would be more accurate in most places.

Event Timeline

aheinecke triaged this task as Wishlist priority.Jul 20 2022, 11:47 AM
aheinecke created this task.

Thinking about this, the best way to avoid AD code in Kleopatra would probably be to just create a QProcess that executes Powershell or WMIC to query the AD.

Here are more examples:
https://stackoverflow.com/questions/10184052/get-a-users-email-address-from-the-username-via-powershell-and-wmi