mod_authn_file.c revision 75031befec2825183c13931fc3266b56ed575c3d
0ad489b182ebb3789322345e22cf750f88ae167and/* Licensed to the Apache Software Foundation (ASF) under one or more
0ad489b182ebb3789322345e22cf750f88ae167and * contributor license agreements. See the NOTICE file distributed with
0ad489b182ebb3789322345e22cf750f88ae167and * this work for additional information regarding copyright ownership.
17ade6df5ec233536985eb1c130a906c725dd614humbedooh * The ASF licenses this file to You under the Apache License, Version 2.0
0ad489b182ebb3789322345e22cf750f88ae167and * (the "License"); you may not use this file except in compliance with
0ad489b182ebb3789322345e22cf750f88ae167and * the License. You may obtain a copy of the License at
031b91a62d25106ae69d4693475c79618dd5e884fielding * Unless required by applicable law or agreed to in writing, software
031b91a62d25106ae69d4693475c79618dd5e884fielding * distributed under the License is distributed on an "AS IS" BASIS,
031b91a62d25106ae69d4693475c79618dd5e884fielding * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0ad489b182ebb3789322345e22cf750f88ae167and * See the License for the specific language governing permissions and
0ad489b182ebb3789322345e22cf750f88ae167and * limitations under the License.
0ad489b182ebb3789322345e22cf750f88ae167andtypedef struct {
5652dbe450e4fcfdf36d4cfb42d7f2345ded29a4maczniakstatic void *create_authn_file_dir_config(apr_pool_t *p, char *d)
0ad489b182ebb3789322345e22cf750f88ae167and authn_file_config_rec *conf = apr_palloc(p, sizeof(*conf));
5652dbe450e4fcfdf36d4cfb42d7f2345ded29a4maczniak conf->pwfile = NULL; /* just to illustrate the default really */
5652dbe450e4fcfdf36d4cfb42d7f2345ded29a4maczniakstatic const char *set_authn_file_slot(cmd_parms *cmd, void *offset,
5652dbe450e4fcfdf36d4cfb42d7f2345ded29a4maczniak const char *f, const char *t)
5652dbe450e4fcfdf36d4cfb42d7f2345ded29a4maczniak return apr_pstrcat(cmd->pool, "Invalid auth file type: ", t, NULL);
5652dbe450e4fcfdf36d4cfb42d7f2345ded29a4maczniak AP_INIT_TAKE12("AuthUserFile", set_authn_file_slot,
0ad489b182ebb3789322345e22cf750f88ae167and OR_AUTHCFG, "text file containing user IDs and passwords"),
5652dbe450e4fcfdf36d4cfb42d7f2345ded29a4maczniakstatic authn_status check_password(request_rec *r, const char *user,
0ad489b182ebb3789322345e22cf750f88ae167and const char *password)
5652dbe450e4fcfdf36d4cfb42d7f2345ded29a4maczniak authn_file_config_rec *conf = ap_get_module_config(r->per_dir_config,
5652dbe450e4fcfdf36d4cfb42d7f2345ded29a4maczniak const char *rpw, *w;
5652dbe450e4fcfdf36d4cfb42d7f2345ded29a4maczniak /* Skip # or blank lines. */
5652dbe450e4fcfdf36d4cfb42d7f2345ded29a4maczniak if ((l[0] == '#') || (!l[0])) {
5652dbe450e4fcfdf36d4cfb42d7f2345ded29a4maczniak status = apr_password_validate(password, file_password);
5652dbe450e4fcfdf36d4cfb42d7f2345ded29a4maczniakstatic authn_status get_realm_hash(request_rec *r, const char *user,
5652dbe450e4fcfdf36d4cfb42d7f2345ded29a4maczniak authn_file_config_rec *conf = ap_get_module_config(r->per_dir_config,
0ad489b182ebb3789322345e22cf750f88ae167and const char *rpw, *w, *x;
0ad489b182ebb3789322345e22cf750f88ae167and /* Skip # or blank lines. */
0ad489b182ebb3789322345e22cf750f88ae167and if ((l[0] == '#') || (!l[0])) {
5652dbe450e4fcfdf36d4cfb42d7f2345ded29a4maczniak /* Remember that this is a md5 hash of user:realm:password. */
0ad489b182ebb3789322345e22cf750f88ae167and ap_register_auth_provider(p, AUTHN_PROVIDER_GROUP, "file",
5652dbe450e4fcfdf36d4cfb42d7f2345ded29a4maczniak create_authn_file_dir_config, /* dir config creater */