[Freeipa-devel] [PATCH] 1046 add e-mail by default

Martin Kosek mkosek at redhat.com
Thu Sep 6 12:45:22 UTC 2012


On 08/24/2012 07:54 PM, Rob Crittenden wrote:
> We weren't automatically creating the mail attribute despite having the default
> e-mail domain. This patch will add it to all new users.
> 
> To disable creating this set the default e-mail domain to empty in ipa config.
> 
> rob
> 

1) Patch needs a rebase

2) There are 2 test cases where new default mail attribute was not added:

======================================================================
FAIL: test_user[34]: user_find: Search for "tuser2" with manager "tuser1"
----------------------------------------------------------------------
...
  extra keys = ['mail']
...

======================================================================
FAIL: test_user[75]: user_add: Create 2nd admin user "admin2"
----------------------------------------------------------------------
...
  extra keys = ['mail']
...

3) Some code could be simplified:

This:
+        if 'ipadefaultemaildomain' in config:
+            defaultdomain = config['ipadefaultemaildomain'][0]
+        else:
+            defaultdomain = None

To this:
             defaultdomain = config.get('ipadefaultemaildomain', [None])[0]


This:
if m.find('@') == -1 ...

To this:
if '@' not in m ...

IMHO, it is more readable than the find method.

3) When default e-mail domain is removed from config, users cannot be added any
more when e-mail is not explicitly specified:

# ipa config-mod --emaildomain=
  Maximum username length: 32
  Home directory base: /home
  Default shell: /bin/sh
  Default users group: ipausers
  Search time limit: 2
  Search size limit: 100
  User search fields: uid,givenname,sn,telephonenumber,ou,title
  Group search fields: cn,description
  Enable migration mode: FALSE
  Certificate Subject base: O=IDM.LAB.BOS.REDHAT.COM
  Password Expiration Notification (days): 4
  Password plugin features: AllowNThash
  SELinux user map order:
guest_u:s0$xguest_u:s0$user_u:s0-s0:c0.c1023$staff_u:s0-s0:c0.c1023$unconfined_u:s0-s0:c0.c1023
  Default SELinux user: guest_u:s0
  PAC type: MS-PAC

# ipa user-add --first=Foo --last=Bar fbar
ipa: ERROR: invalid 'email': invalid e-mail format: fbar

Martin




More information about the Freeipa-devel mailing list