[Date Prev][Date Next] [Chronological] [Thread] [Top]

Coding help



Hi all.

I still with my little password problem between two different versions here.

The site:
OpenLDAP server v1.2
OpenLDAP client v2.0

using v1.2 tools:
# ldapsearch [blablabla]
userpassword={crypt}abouyZjZlf.iA

using v2.0 tools:
# ldapsearch [blablabla]
userpassword:: e2NyeXB0fWFib3V5WmpabGYuaUE=

Trouble part of my C code (yes, it is from wu-ftpd-2.6.1-ldap/src/ldapftp.c):
/*
 * Calculate the standard crypt password.
 */
static char *crypt_passwd(char *cred, char *salt)
{
	unsigned char CRYPTdigest[13];

	strcpy (CRYPTdigest, (char *) crypt(cred, salt));

	if (lutil_b64_ntop(CRYPTdigest, sizeof(CRYPTdigest),
			base64digest, sizeof(base64digest)) < 0)
		return 0;

	return base64digest;
}

/* the function check_pass compares the base64'fied plaintext buf variable with
the base64'fied plaintext read userPassword from LDAP */

int main() {
	/*
	 * Crypt the supplied password and compare it.
	 */
	s=crypt_passwd(passwd, salt);

	if (s) {
		sprintf(buf,"{crypt}%s",s);
		if (check_pass(buf)) return 1;
	}

}

The values:
plain text: 011296
crypt pwd: abouyZjZlf.iA
base64 crypted pwd: YWJvdXlaalpsZi5pQQ==

But i need to obtain as base64 value e2NyeXB0fWFib3V5WmpabGYuaUE=

What i am doing wrong?

TIA

--
Alexandre Hautequest
hquest at fesppr.br

"Globalização: Um paraguaio dirigindo pelas estradas brasileiras um carro 
francês fabricado na Argentina utilizando gasolina iraquiana, ouvindo música
americana num som japonês."

-------------------------------------------------
Esta mensagem foi enviada pelo WebMail da FESP.
Conheça a FESP: http://www.fesppr.br/