Fix parameters passed by Novell code in post-auth.
authorAlan T. DeKok <aland@freeradius.org>
Wed, 21 Jul 2010 12:16:54 +0000 (14:16 +0200)
committerAlan T. DeKok <aland@freeradius.org>
Thu, 22 Jul 2010 13:42:12 +0000 (15:42 +0200)
The "close connection" function takes an "ldap inst" variable,
not a pointer to a list of connections (sigh)

src/modules/rlm_ldap/rlm_ldap.c

index cb4343c..c5ef9f0 100644 (file)
@@ -391,6 +391,18 @@ static inline void ldap_release_conn(int i, ldap_instance *inst)
        pthread_mutex_unlock(&(conns[i].mutex));
 }
 
+#ifdef NOVELL
+static inline void ldap_release_apc_conn(int i, ldap_instance *inst)
+                                    
+{
+       LDAP_CONN *conns = inst->apc_conns;
+
+       DEBUG("  [%s] ldap_release_conn: Release Id: %d", inst->xlat_name, i);
+       conns[i].locked = 0;
+       pthread_mutex_unlock(&(conns[i].mutex));
+}
+#endif
+
 /*************************************************************************
  *
  *     Function: rlm_ldap_instantiate
@@ -1640,7 +1652,7 @@ static int ldap_authorize(void *instance, REQUEST * request)
                                if ((vp_auth_opt = paircreate(auth_opt_attr, PW_TYPE_STRING)) == NULL){
                                        radlog(L_ERR, "  [%s] Could not allocate memory. Aborting.", inst->xlat_name);
                                        ldap_msgfree(result);
-                                       ldap_release_conn(conn_id, inst->conns);
+                                       ldap_release_conn(conn_id, inst);
                                }
                                strcpy(vp_auth_opt->vp_strvalue, auth_option[0]);
                                vp_auth_opt->length = strlen(auth_option[0]);
@@ -2143,7 +2155,7 @@ static int ldap_postauth(void *instance, REQUEST * request)
                                                }
 
                                                vp_apc->vp_strvalue[0] = '3';
-                                               ldap_release_conn(conn_id, inst->apc_conns);
+                                               ldap_release_apc_conn(conn_id, inst);
                                                return RLM_MODULE_REJECT;
                                        }
                                        conn->bound = 1;
@@ -2160,11 +2172,11 @@ static int ldap_postauth(void *instance, REQUEST * request)
                                                ldap_memfree((void *)error_msg);
                                        }
                                        vp_apc->vp_strvalue[0] = '3';
-                                       ldap_release_conn(conn_id, inst->apc_conns);
+                                       ldap_release_apc_conn(conn_id, inst);
                                        return RLM_MODULE_REJECT;
                                }
                                vp_apc->vp_strvalue[0] = '3';
-                               ldap_release_conn(conn_id, inst->apc_conns);
+                               ldap_release_apc_conn(conn_id, inst);
                                return RLM_MODULE_OK;
                        }
        }