diff -ur Unreal3.2.orig/include/config.h Unreal3.2/include/config.h
--- Unreal3.2.orig/include/config.h	2006-12-22 21:10:30.000000000 +0000
+++ Unreal3.2/include/config.h	2007-06-16 19:26:18.000000000 +0100
@@ -217,28 +217,29 @@
 /* CHROOTDIR
  *
  * This enables running the IRCd chrooted (requires initial root privileges,
- * but will be dropped to IRC_UID/IRC_GID privileges if those are defined).
+ * but will be dropped to IRC_USER/IRC_GROUP privileges if those are defined).
  *
  * The directory to chroot to is simply DPATH (which is set via ./Config).
  * (This may effect the PATH locations above, though you can symlink it)
  *
- * Usually you only simply need to enable this, and set IRC_UID and IRC_GID,
- * you don't need to create a special chroot environment.. UnrealIRCd will
- * do that by itself (Unreal will create /dev/random, etc. etc.).
+ * Usually you only simply need to enable this, and set IRC_USER and 
+ * IRC_GROUP, you don't need to create a special chroot environment.. 
+ * UnrealIRCd will do that by itself (Unreal will create /dev/random, 
+ * etc. etc.).
  *
  * Change to '#define CHROOTDIR' to enable...
  */
 /* #define CHROOTDIR    */
 
 /*
- * IRC_UID
+ * IRC_USER
  *
  * If you start the server as root but wish to have it run as another user,
- * define IRC_UID to that UID.  This should only be defined if you are running
- * as root and even then perhaps not.
+ * define IRC_USER to that user name.  This should only be defined if you 
+ * are running as root and even then perhaps not.
  */
-/* #define IRC_UID <uid> */
-/* #define IRC_GID <uid> */
+/* #define IRC_USER  "<user name>" */
+/* #define IRC_GROUP "<group name>" */
 
 
 /* SHOW_INVISIBLE_LUSERS
@@ -461,8 +462,8 @@
 #define	CONFIGFILE CPATH
 #define	IRCD_PIDFILE PPATH
 
-#if defined(CHROOTDIR) && !defined(IRC_UID)
-#error "ERROR: It makes no sense to define CHROOTDIR but not IRC_UID and IRC_GID! Please define IRC_UID and IRC_GID properly as the uid/gid to change to."
+#if defined(CHROOTDIR) && !defined(IRC_USER)
+#error "ERROR: It makes no sense to define CHROOTDIR but not IRC_USER and IRC_GROUP! Please define IRC_USER and IRC_GROUP properly as the user/group to change to."
 #endif
 
 #ifdef	__osf__
Only in Unreal3.2/include: config.h.orig
diff -ur Unreal3.2.orig/src/ircd.c Unreal3.2/src/ircd.c
--- Unreal3.2.orig/src/ircd.c	2006-12-22 21:10:31.000000000 +0000
+++ Unreal3.2/src/ircd.c	2007-06-16 19:26:43.000000000 +0100
@@ -37,6 +37,7 @@
 #ifndef _WIN32
 #include <sys/file.h>
 #include <pwd.h>
+#include <grp.h>
 #include <sys/time.h>
 #else
 #include <io.h>
@@ -96,6 +97,8 @@
 extern MODVAR aMotd *botmotd;
 extern MODVAR aMotd *smotd;
 MODVAR MemoryInfo StatsZ;
+uid_t irc_uid = 0;
+gid_t irc_gid = 0; 
 
 int  R_do_dns, R_fin_dns, R_fin_dnsc, R_fail_dns, R_do_id, R_fin_id, R_fail_id;
 
@@ -918,6 +921,8 @@
 	uid_t uid, euid;
 	gid_t gid, egid;
 	TS   delay = 0;
+	struct passwd *pw;
+	struct group *gr;
 #endif
 #ifdef HAVE_PSTAT
 	union pstun pstats;
@@ -1414,7 +1419,7 @@
 	R_fin_id = strlen(REPORT_FIN_ID);
 	R_fail_id = strlen(REPORT_FAIL_ID);
 
-#if !defined(IRC_UID) && !defined(_WIN32)
+#if !defined(IRC_USER) && !defined(_WIN32)
 	if ((uid != euid) && !euid) {
 		(void)fprintf(stderr,
 		    "ERROR: do not run ircd setuid root. Make it setuid a normal user.\n");
@@ -1422,12 +1427,24 @@
 	}
 #endif
 
-#if defined(IRC_UID) && defined(IRC_GID)
+#if defined(IRC_USER) && defined(IRC_GROUP)
 	if ((int)getuid() == 0) {
-		if ((IRC_UID == 0) || (IRC_GID == 0)) {
+
+		pw = getpwnam(IRC_USER);
+		gr = getgrnam(IRC_GROUP);
+
+		if ((pw == NULL) || (gr == NULL)) {
+			fprintf(stderr, "ERROR: Unable to change to specified user or group: %s\n", strerror(errno));
+			exit(-1);
+		} else {
+			irc_uid = pw->pw_uid;
+			irc_gid = gr->gr_gid;
+		}
+
+		if ((irc_uid == 0) || (irc_gid == 0)) {
 			(void)fprintf(stderr,
 			    "ERROR: SETUID and SETGID have not been set properly"
-			    "\nPlease read your documentation\n(HINT: IRC_UID and IRC_GID in include/config.h can not be 0)\n");
+			    "\nPlease read your documentation\n(HINT: IRC_USER and IRC_GROUP in include/config.h cannot be root/wheel)\n");
 			exit(-1);
 		} else {
 			/*
@@ -1435,14 +1452,14 @@
 			 */
 
 			(void)fprintf(stderr, "WARNING: ircd invoked as root\n");
-			(void)fprintf(stderr, "         changing to uid %d\n", IRC_UID);
-			(void)fprintf(stderr, "         changing to gid %d\n", IRC_GID);
-			if (setgid(IRC_GID))
+			(void)fprintf(stderr, "         changing to uid %d\n", irc_uid);
+			(void)fprintf(stderr, "         changing to gid %d\n", irc_gid);
+			if (setgid(irc_gid))
 			{
 				fprintf(stderr, "ERROR: Unable to change group: %s\n", strerror(errno));
 				exit(-1);
 			}
-			if (setuid(IRC_UID))
+			if (setuid(irc_uid))
 			{
 				fprintf(stderr, "ERROR: Unable to change userid: %s\n", strerror(errno));
 				exit(-1);
Only in Unreal3.2/src: ircd.c.orig
diff -ur Unreal3.2.orig/src/support.c Unreal3.2/src/support.c
--- Unreal3.2.orig/src/support.c	2007-02-18 21:05:50.000000000 +0000
+++ Unreal3.2/src/support.c	2007-06-16 19:27:29.000000000 +0100
@@ -37,6 +37,8 @@
 #ifdef _WIN32
 #include <io.h>
 #else
+extern uid_t irc_uid;
+extern gid_t irc_gid;
 #include <sys/socket.h>
 #include <string.h>
 #include <utime.h>
@@ -1809,9 +1811,9 @@
 	close(srcfd);
 	close(destfd);
 	unreal_setfilemodtime(dest, mtime);
-#if defined(IRC_UID) && defined(IRC_GID)
+#if defined(IRC_USER) && defined(IRC_GROUP)
 	if (!loop.ircd_booted)
-		chown(dest, IRC_UID, IRC_GID);
+		chown(dest, irc_uid, irc_gid);
 #endif
 	return 1;
 fail:
Only in Unreal3.2/src: support.c.orig
diff -ur Unreal3.2.orig/src/url.c Unreal3.2/src/url.c
--- Unreal3.2.orig/src/url.c	2006-06-16 19:29:16.000000000 +0100
+++ Unreal3.2/src/url.c	2007-06-16 19:26:19.000000000 +0100
@@ -29,6 +29,11 @@
 extern char *SSLKeyPasswd;
 #endif
 
+#ifndef _WIN32
+extern uid_t irc_uid;
+extern gid_t irc_gid;
+#endif
+
 CURLM *multihandle;
 
 /* Stores information about the async transfer.
@@ -182,9 +187,9 @@
 	curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, errorbuf);
 	res = curl_easy_perform(curl);
 	fclose(fd);
-#if defined(IRC_UID) && defined(IRC_GID)
+#if defined(IRC_USER) && defined(IRC_GROUP)
 	if (!loop.ircd_booted)
-		chown(tmp, IRC_UID, IRC_GID);
+		chown(tmp, irc_uid, irc_gid);
 #endif
 	if (file)
 		free(file);
@@ -338,9 +343,9 @@
 			curl_easy_getinfo(easyhand, CURLINFO_EFFECTIVE_URL, &url);
 			curl_easy_getinfo(easyhand, CURLINFO_FILETIME, &last_mod);
 			fclose(handle->fd);
-#if defined(IRC_UID) && defined(IRC_GID)
+#if defined(IRC_USER) && defined(IRC_GROUP)
 			if (!loop.ircd_booted)
-				chown(handle->filename, IRC_UID, IRC_GID);
+				chown(handle->filename, irc_uid, irc_gid);
 #endif
 			if (msg->data.result == CURLE_OK)
 			{
