Changeset 2755
- Timestamp:
- Feb 26, 2016, 2:06:58 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/server/common/oursrc/httpdmods/mod_vhost_ldap.c
r1608 r2755 90 90 char *dn; /* The saved dn from a successful search */ 91 91 char *name; /* ServerName */ 92 char *admin; /* ServerAdmin */ 93 char *docroot; /* DocumentRoot */ 94 char *cgiroot; /* ScriptAlias */ 92 char *home; /* HOME */ 93 char *directory; /* DocumentRoot relative to HOME/web_scripts */ 95 94 char *uid; /* Suexec Uid */ 96 95 char *gid; /* Suexec Gid */ … … 98 97 99 98 char *attributes[] = 100 { " apacheServerName", "apacheDocumentRoot", "apacheScriptAlias", "apacheSuexecUid", "apacheSuexecGid", "apacheServerAdmin", 0 };99 { "scriptsVhostName", "homeDirectory", "scriptsVhostDirectory", "uidNumber", "gidNumber", 0 }; 101 100 102 101 static int total_modules; … … 304 303 } 305 304 else { 306 conf->filter = "objectClass= apacheConfig";305 conf->filter = "objectClass=scriptsVhost"; 307 306 } 308 307 … … 509 508 if (ldap_bv2escaped_filter_value(&hostnamebv, &shostnamebv) != 0) 510 509 goto null; 511 apr_snprintf(filtbuf, FILTER_LENGTH, "(&(%s)(|( apacheServerName=%s)(apacheServerAlias=%s)))", conf->filter, shostnamebv.bv_val, shostnamebv.bv_val);510 apr_snprintf(filtbuf, FILTER_LENGTH, "(&(%s)(|(scriptsVhostName=%s)(scriptsVhostAlias=%s)))", conf->filter, shostnamebv.bv_val, shostnamebv.bv_val); 512 511 ber_memfree(shostnamebv.bv_val); 513 512 … … 587 586 char *val = apr_pstrdup (r->pool, vals[i]); 588 587 /* These do not correspond to any real directives */ 589 if (strcasecmp (attributes[i], " apacheSuexecUid") == 0) {588 if (strcasecmp (attributes[i], "uidNumber") == 0) { 590 589 reqc->uid = val; 591 590 continue; 592 591 } 593 else if (strcasecmp (attributes[i], " apacheSuexecGid") == 0) {592 else if (strcasecmp (attributes[i], "gidNumber") == 0) { 594 593 reqc->gid = val; 595 594 continue; 596 595 } 597 598 if (strcasecmp (attributes[i], "apacheServerName") == 0) { 596 else if (strcasecmp (attributes[i], "homeDirectory") == 0) { 597 reqc->home = val; 598 continue; 599 } 600 else if (strcasecmp (attributes[i], "scriptsVhostDirectory") == 0) { 601 reqc->directory = val; 602 continue; 603 } 604 605 if (strcasecmp (attributes[i], "scriptsVhostName") == 0) { 599 606 reqc->name = val; 600 607 directive = "ServerName"; 601 }602 else if (strcasecmp (attributes[i], "apacheServerAdmin") == 0) {603 reqc->admin = val;604 directive = "ServerAdmin";605 }606 else if (strcasecmp (attributes[i], "apacheDocumentRoot") == 0) {607 reqc->docroot = val;608 directive = "DocumentRoot";609 }610 else if (strcasecmp (attributes[i], "apacheScriptAlias") == 0) {611 if (val != NULL) {612 /* Hack to deal with current apacheScriptAlias lagout */613 if (strlen(val) > 0 && val[strlen(val) - 1] == '/')614 val = apr_pstrcat(r->pool, "/cgi-bin/ ", val, (const char *)NULL);615 else616 val = apr_pstrcat(r->pool, "/cgi-bin/ ", val, "/", (const char *)NULL);617 directive = "ScriptAlias";618 }619 reqc->cgiroot = val;620 608 } 621 609 else { … … 637 625 ap_log_rerror(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r, 638 626 "[mod_vhost_ldap.c]: loaded from ldap: " 639 "apacheServerName: %s, " 640 "apacheServerAdmin: %s, " 641 "apacheDocumentRoot: %s, " 642 "apacheScriptAlias: %s, " 643 "apacheSuexecUid: %s, " 644 "apacheSuexecGid: %s", 645 reqc->name, reqc->admin, reqc->docroot, reqc->cgiroot, reqc->uid, reqc->gid); 646 647 if ((reqc->name == NULL)||(reqc->docroot == NULL)) { 627 "scriptsVhostName: %s, " 628 "homeDirectory: %s, " 629 "scriptsVhostDirectory: %s, " 630 "uidNumber: %s, " 631 "gidNumber: %s", 632 reqc->name, reqc->home, reqc->directory, reqc->uid, reqc->gid); 633 634 if (reqc->name == NULL || reqc->home == NULL || reqc->directory == NULL) { 648 635 ap_log_rerror(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, 0, r, 649 636 "[mod_vhost_ldap.c] translate: " … … 651 638 return HTTP_INTERNAL_SERVER_ERROR; 652 639 } 640 641 char *docroot = 642 strcmp(reqc->directory, ".") == 0 ? 643 apr_pstrcat(r->pool, reqc->home, "/web_scripts", (const char *)NULL) : 644 apr_pstrcat(r->pool, reqc->home, "/web_scripts/", reqc->directory, (const char *)NULL); 645 if ((code = reconfigure_directive(r->pool, server, "DocumentRoot", docroot)) != 0) 646 return code; 653 647 654 648 if (reqc->uid != NULL) {
Note: See TracChangeset
for help on using the changeset viewer.