htpasswd.c revision d6fc66efa723db8b3ee5e9fd32579bed884e4e58
ad1ad5c8e36ea795034fcdac660b15d7c141d55bSusant Sahani/* Licensed to the Apache Software Foundation (ASF) under one or more
ad1ad5c8e36ea795034fcdac660b15d7c141d55bSusant Sahani * contributor license agreements. See the NOTICE file distributed with
ad1ad5c8e36ea795034fcdac660b15d7c141d55bSusant Sahani * this work for additional information regarding copyright ownership.
ad1ad5c8e36ea795034fcdac660b15d7c141d55bSusant Sahani * The ASF licenses this file to You under the Apache License, Version 2.0
ad1ad5c8e36ea795034fcdac660b15d7c141d55bSusant Sahani * (the "License"); you may not use this file except in compliance with
ad1ad5c8e36ea795034fcdac660b15d7c141d55bSusant Sahani * the License. You may obtain a copy of the License at
ad1ad5c8e36ea795034fcdac660b15d7c141d55bSusant Sahani * Unless required by applicable law or agreed to in writing, software
ad1ad5c8e36ea795034fcdac660b15d7c141d55bSusant Sahani * distributed under the License is distributed on an "AS IS" BASIS,
ad1ad5c8e36ea795034fcdac660b15d7c141d55bSusant Sahani * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
ad1ad5c8e36ea795034fcdac660b15d7c141d55bSusant Sahani * See the License for the specific language governing permissions and
ad1ad5c8e36ea795034fcdac660b15d7c141d55bSusant Sahani * limitations under the License.
ad1ad5c8e36ea795034fcdac660b15d7c141d55bSusant Sahani/******************************************************************************
ad1ad5c8e36ea795034fcdac660b15d7c141d55bSusant Sahani ******************************************************************************
ad1ad5c8e36ea795034fcdac660b15d7c141d55bSusant Sahani * NOTE! This program is not safe as a setuid executable! Do not make it
ad1ad5c8e36ea795034fcdac660b15d7c141d55bSusant Sahani ******************************************************************************
ad1ad5c8e36ea795034fcdac660b15d7c141d55bSusant Sahani *****************************************************************************/
ad1ad5c8e36ea795034fcdac660b15d7c141d55bSusant Sahani * htpasswd.c: simple program for manipulating password file for
ad1ad5c8e36ea795034fcdac660b15d7c141d55bSusant Sahani * the Apache HTTP server
ad1ad5c8e36ea795034fcdac660b15d7c141d55bSusant Sahani * Originally by Rob McCool
* 1: Failure; file access/permission problem
#include "passwd_common.h"
#include "apr_signal.h"
#include "apr_getopt.h"
#if APR_HAVE_STDIO_H
#include <stdio.h>
#include "apr_md5.h"
#include "apr_sha1.h"
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#ifdef WIN32
#include <conio.h>
int ret;
if (ret)
return ret;
return ERR_OVERFLOW;
static void usage(void)
apr_file_close(f);
static void terminate(void)
#ifdef NETWARE
pressanykey();
char **pwfilename)
const char *arg;
int i, ret;
char opt;
const char *opt_arg;
switch (opt) {
args_left--;
if (ret) {
args_left++;
usage();
usage();
char *dirname;
int found = 0;
int mask = 0;
int existing_file = 0;
if (rv) {
if (rv) {
if (rv) {
if (existing_file) {
exit(i);
exit(0);
argv[0]);
char *colon;
++scratch;
found++;
found++;
exit(0);
APR_SUCCESS) {