]> git.sur5r.net Git - openldap/blobdiff - contrib/slapd-modules/passwd/netscape.c
Merge remote branch 'origin/mdb.master' into OPENLDAP_REL_ENG_2_4
[openldap] / contrib / slapd-modules / passwd / netscape.c
index 3c7d9515a484f659ad5f9090e41f759b358d0b6a..52b19b14cffbcaca6f0b258c59a5f494b77e67d7 100644 (file)
@@ -1,6 +1,7 @@
 /* $OpenLDAP$ */
-/*
- * Copyright 1998-2004 The OpenLDAP Foundation.
+/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
+ *
+ * Copyright 1998-2011 The OpenLDAP Foundation.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * <http://www.OpenLDAP.org/license.html>.
  */
 
-#include <string.h>
 #include <unistd.h>
 
 #include <lber.h>
 #include <lber_pvt.h>
 #include "lutil.h"
 #include "lutil_md5.h"
+#include <ac/string.h>
 
 static LUTIL_PASSWD_CHK_FUNC chk_ns_mta_md5;
 static const struct berval scheme = BER_BVC("{NS-MTA-MD5}");
@@ -36,7 +37,7 @@ static int chk_ns_mta_md5(
        int i;
 
        if( passwd->bv_len != NS_MTA_MD5_PASSLEN ) {
-               return 1;
+               return LUTIL_PASSWD_ERR;
        }
 
        /* hash credentials with salt */
@@ -72,7 +73,7 @@ static int chk_ns_mta_md5(
 
        /* compare */
        return memcmp((char *)passwd->bv_val,
-               (char *)buffer, sizeof(buffer)) ? 1 : 0;
+               (char *)buffer, sizeof(buffer)) ? LUTIL_PASSWD_ERR : LUTIL_PASSWD_OK;
 }
 
 int init_module(int argc, char *argv[]) {