removed old code
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@886 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -5,32 +5,6 @@ RCSID("$Id$");
|
||||
|
||||
#include "otp_locl.h"
|
||||
|
||||
static int
|
||||
get_filename (char *user, char *buf, size_t len)
|
||||
{
|
||||
struct passwd *pwd;
|
||||
|
||||
pwd = getpwnam (user);
|
||||
if (pwd == NULL)
|
||||
return -1;
|
||||
|
||||
strncpy (buf, pwd->pw_dir, len);
|
||||
buf[len - 1] = '\0';
|
||||
strncat (buf, OTPKEYS, len - strlen(buf));
|
||||
buf[len - 1] = '\0';
|
||||
return 0;
|
||||
}
|
||||
|
||||
static FILE *
|
||||
open_file (char *user, char *mode)
|
||||
{
|
||||
char fname[BUFSIZ];
|
||||
|
||||
if (get_filename (user, fname, sizeof(fname)))
|
||||
return NULL;
|
||||
return fopen (fname, mode);
|
||||
}
|
||||
|
||||
void *
|
||||
otp_db_open ()
|
||||
{
|
||||
@@ -62,28 +36,6 @@ otp_db_close (void *dbm)
|
||||
unlink (OTP_DB_LOCK);
|
||||
}
|
||||
|
||||
#if 0
|
||||
int
|
||||
otp_put (OtpContext *ctx)
|
||||
{
|
||||
FILE *f;
|
||||
char s[32];
|
||||
|
||||
f = open_file (ctx->user, "w");
|
||||
if (f == NULL)
|
||||
return -1;
|
||||
otp_print_hex (ctx->key, s);
|
||||
if(fprintf (f, "%s %u %s %s\n", ctx->alg->name, ctx->n, ctx->seed, s)
|
||||
< 0) {
|
||||
fclose (f);
|
||||
return -1;
|
||||
}
|
||||
if(fclose (f))
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Read this entry from the database and lock it.
|
||||
*/
|
||||
@@ -154,52 +106,3 @@ otp_put (void *v, OtpContext *ctx)
|
||||
dat.dsize = p - buf;
|
||||
return dbm_store (dbm, key, dat, DBM_REPLACE);
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
int
|
||||
otp_get (OtpContext *ctx)
|
||||
{
|
||||
FILE *f;
|
||||
char buf[BUFSIZ];
|
||||
char *p, *pend;
|
||||
|
||||
f = open_file (ctx->user, "r");
|
||||
if (f == NULL)
|
||||
return -1;
|
||||
if (fgets (buf, sizeof(buf), f) == NULL) {
|
||||
fclose (f);
|
||||
return -1;
|
||||
}
|
||||
fclose (f);
|
||||
|
||||
p = buf;
|
||||
pend = strchr (buf, ' ');
|
||||
if (pend == NULL)
|
||||
return -1;
|
||||
*pend++ = '\0';
|
||||
ctx->alg = otp_find_alg (p);
|
||||
if (ctx->alg == NULL)
|
||||
return -1;
|
||||
p = pend;
|
||||
if (sscanf (p, "%u", &ctx->n) != 1)
|
||||
return -1;
|
||||
pend = strchr (p, ' ');
|
||||
if (pend == NULL)
|
||||
return -1;
|
||||
*pend++ = '\0';
|
||||
p = pend;
|
||||
pend = strchr (p, ' ');
|
||||
if (pend == NULL)
|
||||
return -1;
|
||||
*pend++ = '\0';
|
||||
strncpy (ctx->seed, p, sizeof(ctx->seed));
|
||||
ctx->seed[sizeof(ctx->seed) - 1] = '\0';
|
||||
if (ctx->seed == NULL)
|
||||
return -1;
|
||||
p = pend;
|
||||
if(otp_parse (ctx->key, p))
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user