Subversion Repositories Tewi

Rev

Rev 276 | Rev 296 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 276 Rev 293
Line 1... Line 1...
1
/* $Id: server.c 276 2024-10-08 11:02:04Z nishi $ */
1
/* $Id: server.c 293 2024-10-09 10:50:45Z nishi $ */
2
 
2
 
3
#define SOURCE
3
#define SOURCE
4
 
4
 
5
#include "../config.h"
5
#include "../config.h"
6
 
6
 
Line 524... Line 524...
524
		char* vhost;
524
		char* vhost;
525
		time_t cmtime;
525
		time_t cmtime;
526
		bool rej;
526
		bool rej;
527
		char* host;
527
		char* host;
528
		int port;
528
		int port;
-
 
529
		char* chrootpath;
529
		struct tw_config_entry* vhost_entry;
530
		struct tw_config_entry* vhost_entry;
530
		strftime(date, 512, "%a, %d %b %Y %H:%M:%S %Z", tm);
531
		strftime(date, 512, "%a, %d %b %Y %H:%M:%S %Z", tm);
531
 
532
 
532
		for(i = 0; req.headers[i] != NULL; i += 2) {
533
		for(i = 0; req.headers[i] != NULL; i += 2) {
533
			if(cm_strcaseequ(req.headers[i], "User-Agent")) {
534
			if(cm_strcaseequ(req.headers[i], "User-Agent")) {
Line 587... Line 588...
587
		}
588
		}
588
		name = host;
589
		name = host;
589
		cm_log("Server", "Hostname is `%s', port is `%d'", host, port);
590
		cm_log("Server", "Hostname is `%s', port is `%d'", host, port);
590
		vhost_entry = tw_vhost_match(host, port);
591
		vhost_entry = tw_vhost_match(host, port);
591
#ifdef HAS_CHROOT
592
#ifdef HAS_CHROOT
592
		char* chrootpath = vhost_entry->chroot_path != NULL ? vhost_entry->chroot_path : config.root.chroot_path;
593
		chrootpath = vhost_entry->chroot_path != NULL ? vhost_entry->chroot_path : config.root.chroot_path;
593
		if(chrootpath != NULL) {
594
		if(chrootpath != NULL) {
594
			if(chdir(chrootpath) == 0) {
595
			if(chdir(chrootpath) == 0) {
595
				if(chroot(".") == 0) {
596
				if(chroot(".") == 0) {
596
					cm_log("Server", "Chroot successful");
597
					cm_log("Server", "Chroot successful");
597
				}
598
				}