diff options
Diffstat (limited to 'ldap/clients/dsgw/ckget.c')
-rw-r--r-- | ldap/clients/dsgw/ckget.c | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/ldap/clients/dsgw/ckget.c b/ldap/clients/dsgw/ckget.c new file mode 100644 index 00000000..b436712c --- /dev/null +++ b/ldap/clients/dsgw/ckget.c @@ -0,0 +1,46 @@ +/** + * PROPRIETARY/CONFIDENTIAL. Use of this product is subject to + * license terms. Copyright © 2001 Sun Microsystems, Inc. + * Some preexisting portions Copyright © 2001 Netscape Communications Corp. + * All rights reserved. + */ + +#include <stdio.h> +#include "dsgw.h" + +#include <ssl.h> +#include <sec.h> + +main() +{ + char *p; + time_t expires; + char dn[ 512 ]; + char cookie[ 512 ]; + int rc; + char *pw; + + + printf( "Retrieve an entry from the cookie database\n" ); + + printf( "cookie: " ); + gets( cookie ); + printf( "dn: " ); + gets( dn ); + + rc = dsgw_ckdn2passwd( cookie, dn, &pw ); + if ( rc == 0 ) { + printf( "Cookie valid, password is <%s>\n", pw ); + } else { + if ( rc == DSGW_CKDB_KEY_NOT_PRESENT ) { + printf( "Cookie/DN pair not found in database\n" ); + } else if ( rc == DSGW_CKDB_EXPIRED ) { + printf( "Cookie/DN pair expired\n" ); + } else { + printf( "Unknown DB error\n" ); + } + } + if ( pw != NULL ) { + free( pw ); + } +} |