lists.arthurdejong.org
RSS feed

nss-pam-ldapd commit: r1898 - nss-pam-ldapd/nslcd

[Date Prev][Date Next] [Thread Prev][Thread Next]

nss-pam-ldapd commit: r1898 - nss-pam-ldapd/nslcd



Author: arthur
Date: Sat Jan  5 17:31:29 2013
New Revision: 1898
URL: http://arthurdejong.org/viewvc/nss-pam-ldapd?revision=1898&view=revision

Log:
inline most is_valid_...() functions

Modified:
   nss-pam-ldapd/nslcd/myldap.c

Modified: nss-pam-ldapd/nslcd/myldap.c
==============================================================================
--- nss-pam-ldapd/nslcd/myldap.c        Sat Jan  5 16:44:21 2013        (r1897)
+++ nss-pam-ldapd/nslcd/myldap.c        Sat Jan  5 17:31:29 2013        (r1898)
@@ -315,26 +315,11 @@
   return session;
 }
 
-PURE static inline int is_valid_session(MYLDAP_SESSION *session)
-{
-  return (session != NULL);
-}
-
-PURE static inline int is_open_session(MYLDAP_SESSION *session)
-{
-  return is_valid_session(session) && (session->ld != NULL);
-}
-
-/* note that this does not check the valid flag of the search */
-PURE static inline int is_valid_search(MYLDAP_SEARCH *search)
-{
-  return (search != NULL) && is_open_session(search->session);
-}
-
 PURE static inline int is_valid_entry(MYLDAP_ENTRY *entry)
 {
-  return (entry != NULL) && is_valid_search(entry->search) &&
-         (entry->search->msg != NULL);
+ return (entry != NULL) && (entry->search != NULL) &&
+        (entry->search->session != NULL) && (entry->search->session->ld != 
NULL) &&
+        (entry->search->msg != NULL);
 }
 
 #ifdef HAVE_SASL_INTERACT_T
@@ -764,7 +749,7 @@
   int i;
   time_t current_time;
   /* check parameters */
-  if (!is_valid_session(session))
+  if (session == NULL)
   {
     log_log(LOG_ERR, "myldap_session_check(): invalid parameter passed");
     errno = EINVAL;
@@ -919,7 +904,7 @@
 {
   int i;
   /* check parameter */
-  if (!is_valid_session(session))
+  if (session == NULL)
   {
     log_log(LOG_ERR, "myldap_session_cleanup(): invalid session passed");
     return;
@@ -938,7 +923,7 @@
 void myldap_session_close(MYLDAP_SESSION *session)
 {
   /* check parameter */
-  if (!is_valid_session(session))
+  if (session == NULL)
   {
     log_log(LOG_ERR, "myldap_session_cleanup(): invalid session passed");
     return;
@@ -1066,8 +1051,7 @@
   int i;
   int rc;
   /* check parameters */
-  if (!is_valid_session(session) || (base == NULL) || (filter == NULL) ||
-      (attrs == NULL))
+  if ((session == NULL) || (base == NULL) || (filter == NULL) || (attrs == 
NULL))
   {
     log_log(LOG_ERR, "myldap_search(): invalid parameter passed");
     errno = EINVAL;
@@ -1156,7 +1140,7 @@
   LDAPControl *serverctrls[2];
   ber_int_t count;
   /* check parameters */
-  if (!is_valid_search(search))
+  if ((search == NULL) || (search->session == NULL) || (search->session->ld == 
NULL))
   {
     log_log(LOG_ERR, "myldap_get_entry(): invalid search passed");
     errno = EINVAL;
@@ -1924,7 +1908,7 @@
   int rc;
   struct berval ber_userdn, ber_oldpassword, ber_newpassword, ber_retpassword;
   /* check parameters */
-  if (!is_valid_session(session) || (userdn == NULL) || (newpasswd == NULL))
+  if ((session == NULL) || (userdn == NULL) || (newpasswd == NULL))
   {
     log_log(LOG_ERR, "myldap_passwd(): invalid parameter passed");
     errno = EINVAL;
@@ -1969,7 +1953,7 @@
 
 int myldap_modify(MYLDAP_SESSION *session, const char *dn, LDAPMod * mods[])
 {
-  if (!is_valid_session(session) || (dn == NULL))
+  if ((session == NULL) || (dn == NULL))
   {
     log_log(LOG_ERR, "myldap_passwd(): invalid parameter passed");
     errno = EINVAL;
@@ -1982,7 +1966,7 @@
                          char *buffer, size_t buflen)
 {
   char *msg_diag = NULL;
-  if (!is_valid_session(session) || (buffer == NULL) || (buflen <= 0))
+  if ((session == NULL) || (buffer == NULL) || (buflen <= 0))
   {
     log_log(LOG_ERR, "myldap_error_message(): invalid parameter passed");
     errno = EINVAL;
-- 
To unsubscribe send an email to
nss-pam-ldapd-commits-unsubscribe@lists.arthurdejong.org or see
http://lists.arthurdejong.org/nss-pam-ldapd-commits/