[dovecot-cvs] dovecot/src/lib home-expand.c,NONE,1.1 home-expand.h,NONE,1.1 Makefile.am,1.27,1.28
cras at procontrol.fi
cras at procontrol.fi
Tue Feb 11 21:37:18 EET 2003
Update of /home/cvs/dovecot/src/lib
In directory danu:/tmp/cvs-serv1541/src/lib
Modified Files:
Makefile.am
Added Files:
home-expand.c home-expand.h
Log Message:
Added mail_full_filesystem_access setting. Some of the setting variable
types were declared wrong and caused Dovecot to crash if they were set in
config file.
--- NEW FILE: home-expand.c ---
/* Copyright (C) 2003 Timo Sirainen */
#include "lib.h"
#include "home-expand.h"
#include <stdlib.h>
#include <pwd.h>
/* expand ~/ or ~user/ in beginning of path */
const char *home_expand(const char *path)
{
const char *home, *p, *orig_path;
struct passwd *pw;
if (*path != '~')
return path;
orig_path = path++;
if (*path == '/' || *path == '\0') {
home = getenv("HOME");
if (*path != '\0') path++;
} else {
p = strchr(path, '/');
if (p == NULL) {
pw = getpwnam(path);
path = "";
} else {
pw = getpwnam(t_strdup_until(path, p));
path = p+1;
}
home = pw == NULL ? NULL : pw->pw_dir;
}
if (home == NULL)
return orig_path;
else if (*path == '\0')
return t_strdup(home);
else
return t_strconcat(home, "/", path, NULL);
}
--- NEW FILE: home-expand.h ---
#ifndef __HOME_EXPAND_H
#define __HOME_EXPAND_H
/* expand ~/ or ~user/ in beginning of path */
const char *home_expand(const char *path);
#endif
Index: Makefile.am
===================================================================
RCS file: /home/cvs/dovecot/src/lib/Makefile.am,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- Makefile.am 27 Jan 2003 01:27:51 -0000 1.27
+++ Makefile.am 11 Feb 2003 19:37:16 -0000 1.28
@@ -14,6 +14,7 @@
file-set-size.c \
hash.c \
hex-binary.c \
+ home-expand.c \
hostpid.c \
imem.c \
iostream.c \
@@ -68,6 +69,7 @@
file-set-size.h \
hash.h \
hex-binary.h \
+ home-expand.h \
hostpid.h \
imem.h \
iostream-internal.h \
More information about the dovecot-cvs
mailing list