summaryrefslogtreecommitdiff
path: root/daemon.h
diff options
context:
space:
mode:
Diffstat (limited to 'daemon.h')
-rw-r--r--daemon.h13
1 files changed, 8 insertions, 5 deletions
diff --git a/daemon.h b/daemon.h
index 2b3b00a..9e6f1b2 100644
--- a/daemon.h
+++ b/daemon.h
@@ -13,9 +13,9 @@
* message authentication based on the methodes used by SRTP. It is
* intended to deliver a generic, scaleable and secure solution for
* tunneling and relaying of packets of any protocol.
+ *
*
- *
- * Copyright (C) 2007-2008 Christian Pointner <equinox@anytun.org>
+ * Copyright (C) 2007-2010 Christian Pointner <equinox@anytun.org>
*
* This file is part of uAnytun.
*
@@ -60,7 +60,7 @@ int priv_init(priv_info_t* priv, const char* username, const char* groupname)
priv->pw_ = getpwnam(username);
if(!priv->pw_) {
- log_printf(ERROR, "unkown user %s", username);
+ log_printf(ERROR, "unknown user %s", username);
return -1;
}
@@ -70,7 +70,7 @@ int priv_init(priv_info_t* priv, const char* username, const char* groupname)
priv->gr_ = getgrgid(priv->pw_->pw_gid);
if(!priv->gr_) {
- log_printf(ERROR, "unkown group %s", groupname);
+ log_printf(ERROR, "unknown group %s", groupname);
return -1;
}
@@ -105,10 +105,11 @@ int priv_drop(priv_info_t* priv)
return 0;
}
+
int do_chroot(const char* chrootdir)
{
if(getuid() != 0) {
- log_printf(ERROR, "this programm has to be run as root in order to run in a chroot");
+ log_printf(ERROR, "this program has to be run as root in order to run in a chroot");
return -1;
}
@@ -121,6 +122,7 @@ int do_chroot(const char* chrootdir)
log_printf(ERROR, "can't change to /: %s", strerror(errno));
return -1;
}
+
return 0;
}
@@ -170,3 +172,4 @@ void daemonize()
}
#endif
+