nss-pam-ldapd commit: r1339 - nss-pam-ldapd/nslcd
[
Date Prev][
Date Next]
[
Thread Prev][
Thread Next]
nss-pam-ldapd commit: r1339 - nss-pam-ldapd/nslcd
- From: Commits of the nss-pam-ldapd project <nss-pam-ldapd-commits [at] lists.arthurdejong.org>
- To: nss-pam-ldapd-commits [at] lists.arthurdejong.org
- Reply-to: nss-pam-ldapd-users [at] lists.arthurdejong.org
- Subject: nss-pam-ldapd commit: r1339 - nss-pam-ldapd/nslcd
- Date: Fri, 24 Dec 2010 15:31:05 +0100 (CET)
Author: arthur
Date: Fri Dec 24 15:31:04 2010
New Revision: 1339
URL: http://arthurdejong.org/viewvc/nss-pam-ldapd?view=rev&revision=1339
Log:
make logic of character tests easier to read
Modified:
nss-pam-ldapd/nslcd/common.c
Modified: nss-pam-ldapd/nslcd/common.c
==============================================================================
--- nss-pam-ldapd/nslcd/common.c Mon Dec 20 11:18:27 2010 (r1338)
+++ nss-pam-ldapd/nslcd/common.c Fri Dec 24 15:31:04 2010 (r1339)
@@ -100,13 +100,20 @@
if (i>=LOGIN_NAME_MAX)
return 0;
#endif /* LOGIN_NAME_MAX */
- if ( ! ( ( (i!=0) && (name[i]=='-') ) ||
- ( (i!=0) && (name[i]=='\\') && name[i+1]!='\0' ) ||
- (name[i]>='@' && name[i] <= 'Z') ||
- (name[i]>='a' && name[i] <= 'z') ||
- (name[i]>='0' && name[i] <= '9') ||
- name[i]=='.' || name[i]=='_' || name[i]=='$' || name[i]==' ') )
- return 0;
+ /* characters supported everywhere in the name */
+ if ( (name[i]>='@' && name[i] <= 'Z') ||
+ (name[i]>='a' && name[i] <= 'z') ||
+ (name[i]>='0' && name[i] <= '9') ||
+ name[i]=='.' || name[i]=='_' || name[i]=='$' )
+ continue;
+ /* characters that may be anywhere except as first character */
+ if ( i>0 && name[i]=='-' )
+ continue;
+ /* characters that may not be the first or last character */
+ if ( ( i>0 && name[i+1]!='\0' ) && ( name[i]=='\\' || name[i]==' ') )
+ continue;
+ /* anything else is bad */
+ return 0;
}
/* no test failed so it must be good */
return -1;
--
To unsubscribe send an email to
nss-pam-ldapd-commits-unsubscribe@lists.arthurdejong.org or see
http://lists.arthurdejong.org/nss-pam-ldapd-commits
- nss-pam-ldapd commit: r1339 - nss-pam-ldapd/nslcd,
Commits of the nss-pam-ldapd project