(krb5_addlog_dest): reorganise syslog parsing
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@10904 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
		@@ -1,5 +1,5 @@
 | 
				
			|||||||
/*
 | 
					/*
 | 
				
			||||||
 * Copyright (c) 1997-2000, 2002 Kungliga Tekniska H<>gskolan
 | 
					 * Copyright (c) 1997-2002 Kungliga Tekniska H<>gskolan
 | 
				
			||||||
 * (Royal Institute of Technology, Stockholm, Sweden). 
 | 
					 * (Royal Institute of Technology, Stockholm, Sweden). 
 | 
				
			||||||
 * All rights reserved. 
 | 
					 * All rights reserved. 
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
@@ -315,15 +315,18 @@ krb5_addlog_dest(krb5_context context, krb5_log_facility *f, const char *orig)
 | 
				
			|||||||
	ret = open_file(context, f, min, max, fn, "a", file, keep_open);
 | 
						ret = open_file(context, f, min, max, fn, "a", file, keep_open);
 | 
				
			||||||
    }else if(strncmp(p, "DEVICE=", 6) == 0){
 | 
					    }else if(strncmp(p, "DEVICE=", 6) == 0){
 | 
				
			||||||
	ret = open_file(context, f, min, max, strdup(p + 7), "w", NULL, 0);
 | 
						ret = open_file(context, f, min, max, strdup(p + 7), "w", NULL, 0);
 | 
				
			||||||
    }else if(strncmp(p, "SYSLOG", 6) == 0){
 | 
					    }else if(strncmp(p, "SYSLOG", 6) == 0 && (p[6] == '\0' || p[6] == ':')){
 | 
				
			||||||
	char *severity;
 | 
						char severity[128] = "";
 | 
				
			||||||
	char *facility;
 | 
						char facility[128] = "";
 | 
				
			||||||
	severity = strchr(p, ':');
 | 
						p += 6;
 | 
				
			||||||
	if(severity == NULL)
 | 
						if(*p != '\0')
 | 
				
			||||||
	    severity = "ERR";
 | 
						    p++;
 | 
				
			||||||
	facility = strchr(severity, ':');
 | 
						if(strsep_copy(&p, ":", severity, sizeof(severity)) != -1)
 | 
				
			||||||
	if(facility == NULL)
 | 
						    strsep_copy(&p, ":", facility, sizeof(facility));
 | 
				
			||||||
	    facility = "AUTH";
 | 
						if(*severity == '\0')
 | 
				
			||||||
 | 
						    strlcpy(severity, "ERR", sizeof(severity));
 | 
				
			||||||
 | 
					 	if(*facility == '\0')
 | 
				
			||||||
 | 
						    strlcpy(facility, "AUTH", sizeof(facility));
 | 
				
			||||||
	ret = open_syslog(context, f, min, max, severity, facility);
 | 
						ret = open_syslog(context, f, min, max, severity, facility);
 | 
				
			||||||
    }else{
 | 
					    }else{
 | 
				
			||||||
	krb5_set_error_string (context, "unknown log type: %s", p);
 | 
						krb5_set_error_string (context, "unknown log type: %s", p);
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user