/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
/*
* Copyright 1993 OpenVision Technologies, Inc., All Rights Reserved
*
* $Header$
*/
/*
* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
*
* Openvision retains the copyright to derivative works of
* this source code. Do *NOT* create a derivative of this
* source code before consulting with your legal department.
* Do *NOT* integrate *ANY* of this source code into another
* product before consulting with your legal department.
*
* For further information, read the top-level Openvision
* copyright which is contained in the top-level MIT Kerberos
* copyright.
*
* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
*
*/
#if !defined(lint) && !defined(__CODECENTER__)
#endif
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#ifdef HAVE_MEMORY_H
#include <memory.h>
#endif
#include "adm_proto.h"
#include <syslog.h>
#include "server_internal.h"
#include "k5-platform.h"
/* Solaris Kerberos */
#include <libintl.h>
/*
* Function: word_compare
*
* Purpose: compare two words in the dictionary.
*
* Arguments:
* w1 (input) pointer to first word
* w2 (input) pointer to second word
* <return value> result of strcmp
*
* Requires:
* w1 and w2 to point to valid memory
*
*/
static int
{
}
/*
* Function: init-dict
*
* Purpose: Initialize in memory word dictionary
*
* Arguments:
* none
* <return value> KADM5_OK on success errno on failure;
* (but success on ENOENT)
*
* Requires:
* If WORDFILE exists, it must contain a list of words,
* one word per-line.
*
* Effects:
* If WORDFILE exists, it is read into memory sorted for future
* use. If it does not exist, it syslogs an error message and returns
* success.
*
* Modifies:
* word_list to point to a chunck of allocated memory containing
* pointers to words
* word_block to contain the dictionary.
*
*/
{
int fd,
len,
i;
char *p,
*t;
return KADM5_OK;
/* Solaris Kerberos */
"No dictionary file specified, continuing "
"without one."));
return KADM5_OK;
}
/* Solaris Kerberos */
"WARNING! Cannot find dictionary file %s, "
return KADM5_OK;
} else
return errno;
}
return errno;
}
return ENOMEM;
return errno;
p = word_block;
*t = '\0';
len -= t - p + 1;
p = t + 1;
word_count++;
}
return ENOMEM;
p = word_block;
for (i = 0; i < word_count; i++) {
word_list[i] = p;
p += strlen(p) + 1;
}
return KADM5_OK;
}
/*
* Function: find_word
*
* Purpose: See if the specified word exists in the in-core dictionary
*
* Arguments:
* word (input) word to search for.
* <return value> WORD_NOT_FOUND if not in dictionary,
* KADM5_OK if if found word
* errno if init needs to be called and returns an
* error
*
* Requires:
* word to be a null terminated string.
* That word_list and word_block besetup
*
* Effects:
* finds word in dictionary.
* Modifies:
* nothing.
*
*/
int
{
char **value;
return WORD_NOT_FOUND;
word_compare)) == NULL)
return WORD_NOT_FOUND;
else
return KADM5_OK;
}
/*
* Function: destroy_dict
*
* Purpose: destroy in-core copy of dictionary.
*
* Arguments:
* none
* <return value> none
* Requires:
* nothing
* Effects:
* frees up memory occupied by word_list and word_block
* sets count back to 0, and resets the pointers to NULL
*
* Modifies:
* word_list, word_block, and word_count.
*
*/
void
destroy_dict(void)
{
if(word_list) {
}
if(word_block) {
word_block = NULL;
}
if(word_count)
word_count = 0;
return;
}