/* 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * 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.
*/
/* This module is triggered by an * * AuthGroupFile standard /path/to/file * * and the presence of a * * require group <list-of-groups> * * In an applicable limit/directory block for that method. * * If there are no AuthGroupFile directives valid for * the request; we DECLINED. * * If the AuthGroupFile is defined; but somehow not * accessible: we SERVER_ERROR (was DECLINED). * * If there are no 'require ' directives defined for * this request then we DECLINED (was OK). * * If there are no 'require ' directives valid for * this request method then we DECLINED. (was OK) * * If there are any 'require group' blocks and we * are not in any group - we HTTP_UNAUTHORIZE *
*/
/* If there is no group file - then we are not * configured. So decline.
*/ if (!(conf->groupfile)) {
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(01664) "No group file was specified in the configuration"); return AUTHZ_DENIED;
}
status = groups_for_user(r->pool, user, conf->groupfile,
&grpstatus);
if (status != APR_SUCCESS) {
ap_log_rerror(APLOG_MARK, APLOG_ERR, status, r, APLOGNO(01665) "Could not open group file: %s",
conf->groupfile); return AUTHZ_DENIED;
}
if (apr_is_empty_table(grpstatus)) { /* no groups available, so exit immediately */
ap_log_rerror(APLOG_MARK, APLOG_INFO, 0, r, APLOGNO(01666) "Authorization of user %s to access %s failed, reason: " "user doesn't appear in group file (%s).",
r->user, r->uri, conf->groupfile); return AUTHZ_DENIED;
}
t = require; while ((w = ap_getword_conf(r->pool, &t)) && w[0]) { if (apr_table_get(grpstatus, w)) { return AUTHZ_GRANTED;
}
}
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(01667) "Authorization of user %s to access %s failed, reason: " "user is not part of the 'require'ed group(s).",
r->user, r->uri);
/* If there is no group file - then we are not * configured. So decline.
*/ if (!(conf->groupfile)) {
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(01668) "No group file was specified in the configuration"); return AUTHZ_DENIED;
}
status = groups_for_user(r->pool, user, conf->groupfile,
&grpstatus); if (status != APR_SUCCESS) {
ap_log_rerror(APLOG_MARK, APLOG_ERR, status, r, APLOGNO(01669) "Could not open group file: %s",
conf->groupfile); return AUTHZ_DENIED;
}
if (apr_is_empty_table(grpstatus)) { /* no groups available, so exit immediately */
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(01670) "Authorization of user %s to access %s failed, reason: " "user doesn't appear in group file (%s).",
r->user, r->uri, conf->groupfile); return AUTHZ_DENIED;
}
filegroup = authz_owner_get_file_group(r);
if (filegroup) { if (apr_table_get(grpstatus, filegroup)) { return AUTHZ_GRANTED;
}
} else { /* No need to emit a error log entry because the call to authz_owner_get_file_group already did it for us.
*/ return AUTHZ_DENIED;
}
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(01671) "Authorization of user %s to access %s failed, reason: " "user is not part of the 'require'ed file group.",
r->user, r->uri);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.