/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
/*
*
* Copyright (c) 2004-2005, Novell, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* * The copyright holder's name is not used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
/*
*/
#include <ctype.h>
#include "ldap_main.h"
#include "kdb_ldap.h"
#include "ldap_service_stash.h"
#include <libintl.h> /* Solaris Kerberos */
unsigned char **password)
{
int entryfound=0;
#ifndef HAVE_STRERROR_R
/* Solaris Kerberos: safer macro, added more (), use strlcpy() */
# define strerror_r(ERRNUM, BUF, SIZE) (strlcpy((BUF), strerror(ERRNUM), (SIZE)), (BUF)[(SIZE)-1] = 0)
#endif
/* Solaris Kerberos: access()'s are unsafe and useless */
#if 0 /************** Begin IFDEF'ed OUT *******************************/
/* check whether file exists */
goto rp_exit;
}
/* check read access */
goto rp_exit;
}
#endif /**************** END IFDEF'ed OUT *******************************/
/* Solaris Kerberos: using F to deal with 256 open file limit */
goto rp_exit;
}
/* get the record from the file */
tmp[0] = '\0';
/* Handle leading white-spaces */
/* Handle comment lines */
continue;
if (tmp[0] == '\0')
break;
}
}
if (entryfound == 0) {
goto rp_exit;
}
/* replace the \n with \0 */
if (start)
*start = '\0';
/* password field missing */
goto rp_exit;
}
++ start;
/* Extract the plain password / certificate file information */
{
/* Check if the entry has the path of a certificate */
/* Set *password = {FILE}<path to cert>\0<cert password> */
goto rp_exit;
}
goto got_password;
} else {
if (st != 0) {
switch (st) {
case ERR_NO_MEM:
break;
case ERR_PWD_ZERO:
break;
case ERR_PWD_BAD:
break;
case ERR_PWD_NOT_HEX:
break;
default:
break;
}
goto rp_exit;
}
}
}
if (st) {
if (*password)
}
return st;
}
/* Encodes a sequence of bytes in hexadecimal */
int
{
int i=0, err = 0;
goto cleanup;
}
}
return err;
}
/* The entry in the password file will have the following format
* <FQDN of service> = <secret>
* <secret> := {HEX}<password in hexadecimal>
*
* <password> is the actual eDirectory password of the service
* Return values:
* ERR_NO_MEM - No Memory
* ERR_PWD_ZERO - Password has zero length
* ERR_PWD_BAD - Passowrd corrupted
* ERR_PWD_NOT_HEX - Not a hexadecimal password
*/
int
{
int err=0;
int i=0, j=0;
err = ERR_PWD_ZERO;
goto cleanup;
}
/* Check if it is a hexadecimal encoded password */
/* A hexadecimal encoded password should have even length */
err = ERR_PWD_BAD;
goto cleanup;
}
err = ERR_NO_MEM;
goto cleanup;
}
unsigned int k;
/* Check if it is a hexadecimal number */
goto cleanup;
}
}
goto cleanup;
} else {
goto cleanup;
}
}
return(err);
}