RIP BOOL. Convert BOOL -> bool. I found a few interesting
[kai/samba.git] / source3 / passdb / pdb_nds.c
index 34e550d413937e7ff4b226547288ae479e7e19e9..1edd665d545e6d9a15f1dd3db4d25fa2c8288e7e 100644 (file)
@@ -5,7 +5,7 @@
     
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
+   the Free Software Foundation; either version 3 of the License, or
    (at your option) any later version.
    
    This program is distributed in the hope that it will be useful,
@@ -14,8 +14,7 @@
    GNU General Public License for more details.
    
    You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.
    
 */
 
@@ -241,7 +240,7 @@ static int berDecodeLoginData(
        if(retData)
        {
                retOctStrLen = *retDataLen + 1;
-               retOctStr = SMB_MALLOC(retOctStrLen);
+               retOctStr = SMB_MALLOC_ARRAY(char, retOctStrLen);
                if(!retOctStr)
                {
                        err = LDAP_OPERATIONS_ERROR;
@@ -404,7 +403,7 @@ static int nmasldap_get_simple_pwd(
        size_t  pwdBufLen, bufferLen;
 
        bufferLen = pwdBufLen = pwdLen+2;
-       pwdBuf = SMB_MALLOC(pwdBufLen); /* digest and null */
+       pwdBuf = SMB_MALLOC_ARRAY(char, pwdBufLen); /* digest and null */
        if(pwdBuf == NULL)
        {
                return LDAP_NO_MEMORY;
@@ -568,7 +567,7 @@ static int nmasldap_get_password(
        }
 
        bufferLen = pwdBufLen = *pwdSize;
-       pwdBuf = SMB_MALLOC(pwdBufLen+2);
+       pwdBuf = SMB_MALLOC_ARRAY(char, pwdBufLen+2);
        if(pwdBuf == NULL)
        {
                return LDAP_NO_MEMORY;
@@ -741,7 +740,7 @@ int pdb_nds_set_password(
 *********************************************************************/
 
 static NTSTATUS pdb_nds_update_login_attempts(struct pdb_methods *methods,
-                                       struct samu *sam_acct, BOOL success)
+                                       struct samu *sam_acct, bool success)
 {
        struct ldapsam_privates *ldap_state;
 
@@ -764,12 +763,12 @@ static NTSTATUS pdb_nds_update_login_attempts(struct pdb_methods *methods,
                char clear_text_pw[512];
                LDAP *ld = NULL;
                const char *username = pdb_get_username(sam_acct);
-               BOOL got_clear_text_pw = False;
+               bool got_clear_text_pw = False;
 
                DEBUG(5,("pdb_nds_update_login_attempts: %s login for %s\n",
                                success ? "Successful" : "Failed", username));
 
-               result = pdb_get_backend_private_data(sam_acct, methods);
+               result = (LDAPMessage *)pdb_get_backend_private_data(sam_acct, methods);
                if (!result) {
                        attr_list = get_userattr_list(NULL,
                                                      ldap_state->schema_ver);
@@ -817,9 +816,9 @@ static NTSTATUS pdb_nds_update_login_attempts(struct pdb_methods *methods,
 
                        /* Attempt simple bind with real or bogus password */
                        rc = ldap_simple_bind_s(ld, dn, clear_text_pw);
+                       ldap_unbind(ld);
                        if (rc == LDAP_SUCCESS) {
                                DEBUG(5,("pdb_nds_update_login_attempts: ldap_simple_bind_s Successful for %s\n", username));
-                               ldap_unbind_ext(ld, NULL, NULL);
                        } else {
                                NTSTATUS nt_status = NT_STATUS_ACCOUNT_RESTRICTION;
                                DEBUG(5,("pdb_nds_update_login_attempts: ldap_simple_bind_s Failed for %s\n", username));
@@ -854,7 +853,8 @@ static NTSTATUS pdb_nds_update_login_attempts(struct pdb_methods *methods,
 
 static NTSTATUS pdb_init_NDS_ldapsam_common(struct pdb_methods **pdb_method, const char *location)
 {
-       struct ldapsam_privates *ldap_state = (*pdb_method)->private_data;
+       struct ldapsam_privates *ldap_state =
+               (struct ldapsam_privates *)((*pdb_method)->private_data);
 
        /* Mark this as eDirectory ldap */
        ldap_state->is_nds_ldap = True;