mirror of
https://github.com/owntone/owntone-server.git
synced 2025-04-16 09:08:04 -04:00
Minor win32 fixes, fix path parsing in conf validation to fix ticket #48
This commit is contained in:
parent
f83f66130b
commit
964285cf41
14
src/conf.c
14
src/conf.c
@ -138,18 +138,20 @@ int _conf_makedir(char *path,char *user) {
|
|||||||
DPRINTF(E_FATAL,L_CONF,"Malloc error\n");
|
DPRINTF(E_FATAL,L_CONF,"Malloc error\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
next_token=pathdup+1;
|
next_token=pathdup;
|
||||||
|
while(*next_token && (*next_token != PATHSEP))
|
||||||
|
next_token++;
|
||||||
|
if(*next_token)
|
||||||
|
next_token++;
|
||||||
|
|
||||||
memset(path_buffer,0,sizeof(path_buffer));
|
memset(path_buffer,0,sizeof(path_buffer));
|
||||||
|
|
||||||
while((token=strsep(&next_token,"/"))) {
|
while((token=strsep(&next_token,PATHSEP_STR))) {
|
||||||
if((strlen(path_buffer) + strlen(token)) < PATH_MAX) {
|
if((strlen(path_buffer) + strlen(token)) < PATH_MAX) {
|
||||||
strcat(path_buffer,"/");
|
strcat(path_buffer,PATHSEP_STR);
|
||||||
strcat(path_buffer,token);
|
strcat(path_buffer,token);
|
||||||
|
|
||||||
if(!_conf_existdir(path_buffer)) {
|
if(!_conf_existdir(path_buffer)) {
|
||||||
/* FIXME: this is wrong -- it should really be 0700 owned by
|
|
||||||
* the runas user. That would require some os_ indirection
|
|
||||||
*/
|
|
||||||
DPRINTF(E_DBG,L_CONF,"Making %s\n",path_buffer);
|
DPRINTF(E_DBG,L_CONF,"Making %s\n",path_buffer);
|
||||||
if((mkdir(path_buffer,0700)) && (errno != EEXIST)) {
|
if((mkdir(path_buffer,0700)) && (errno != EEXIST)) {
|
||||||
free(pathdup);
|
free(pathdup);
|
||||||
|
@ -7,6 +7,9 @@
|
|||||||
#ifndef _OS_UNIX_H_
|
#ifndef _OS_UNIX_H_
|
||||||
#define _OS_UNIX_H_
|
#define _OS_UNIX_H_
|
||||||
|
|
||||||
|
#define PATHSEP '/'
|
||||||
|
#define PATHSEP_STR "/"
|
||||||
|
|
||||||
/* unix-specific functions */
|
/* unix-specific functions */
|
||||||
extern int os_drop_privs(char *user);
|
extern int os_drop_privs(char *user);
|
||||||
void os_set_pidfile(char *file);
|
void os_set_pidfile(char *file);
|
||||||
|
@ -12,7 +12,8 @@
|
|||||||
|
|
||||||
#define MAXNAMLEN 255
|
#define MAXNAMLEN 255
|
||||||
#define DIRBLKSIZ 512
|
#define DIRBLKSIZ 512
|
||||||
|
#define PATHSEP '\\'
|
||||||
|
#define PATHSEP_STR "\\"
|
||||||
|
|
||||||
struct timezone {
|
struct timezone {
|
||||||
int tz_minuteswest;
|
int tz_minuteswest;
|
||||||
|
@ -71,7 +71,7 @@
|
|||||||
#define HOST "unknown-windows-ick"
|
#define HOST "unknown-windows-ick"
|
||||||
#define SERVICENAME "Multithreaded DAAP Server"
|
#define SERVICENAME "Multithreaded DAAP Server"
|
||||||
|
|
||||||
#define DEFAULT_CONFIGFILE os_configpath()
|
#define CONFFILE os_configpath()
|
||||||
|
|
||||||
extern char *os_configpath(void);
|
extern char *os_configpath(void);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user