/* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/******************************************************************************
******************************************************************************
* NOTE! This program is not safe as a setuid executable! Do not make it
* setuid!
******************************************************************************
*****************************************************************************/
/*
* htdigest.c: simple program for manipulating digest passwd file for Apache
*
* by Alexei Kosut, based on htpasswd.c, by Rob McCool
*/
#include "apr.h"
#include "apr_file_io.h"
#include "apr_md5.h"
#include "apr_lib.h" /* for apr_getpass() */
#include "apr_general.h"
#include "apr_signal.h"
#include "apr_strings.h" /* for apr_pstrdup() */
#define APR_WANT_STDIO
#define APR_WANT_STRFUNC
#include "apr_want.h"
#endif
#include <stdlib.h>
#endif
#ifdef WIN32
#include <conio.h>
#endif
#else
#endif /* APR_CHARSET_EBCDIC */
#endif
{
if (tfp) {
}
}
{
int x = 0, y;
word[x] = '\0';
if (line[x])
++x;
y = 0;
}
{
int i = 0;
char ch;
/* we need 2 remaining bytes in buffer */
while (i < (n - 2) &&
s[i++] = ch;
}
/* First remaining byte potentially used here */
if (ch == '\n')
s[i++] = ch;
/* Second remaining byte used here */
s[i] = '\0';
if (rv != APR_SUCCESS)
return 1;
return 0;
}
{
int x;
for (x = 0; l[x]; x++)
apr_file_putc(l[x], f);
}
{
char *pw;
unsigned int i;
}
}
/* Do MD5 stuff */
#endif
for (i = 0; i < 16; i++)
apr_file_printf(f, "\n");
}
static void usage(void)
{
exit(1);
}
static void interrupted(void)
{
}
static void terminate(void)
{
#ifdef NETWARE
pressanykey();
#endif
}
{
apr_file_t *f;
char *dirname;
char l[3 * MAX_STRING_LEN];
char w[MAX_STRING_LEN];
char x[MAX_STRING_LEN];
int found;
if (rv) {
exit(1);
}
#endif
if (argc == 5) {
usage();
if (rv != APR_SUCCESS) {
exit(1);
}
apr_file_close(f);
exit(0);
}
else if (argc != 4)
usage();
argv[0]);
exit(1);
}
exit(1);
}
}
found = 0;
continue;
}
getword(w, l, ':');
getword(x, l, ':');
continue;
}
else {
found = 1;
}
}
if (!found) {
}
apr_file_close(f);
/* The temporary file has all the data, just copy it to the new location.
*/
APR_SUCCESS) {
}
return 0;
}