Use geteuid(2) instead of getuid(2) to check own privilege
for Samba support (effective uid is user's uid, but real uid is 0).

-- fumiyas at osstech, 2008-05-12

diff -upr gamin-0.1.9/libgamin/gam_api.c gamin-0.1.9.euid/libgamin/gam_api.c
--- gamin-0.1.9/libgamin/gam_api.c	2007-07-04 22:36:48.000000000 +0900
+++ gamin-0.1.9.euid/libgamin/gam_api.c	2009-01-16 01:24:52.000000000 +0900
@@ -117,7 +117,7 @@ gamin_get_user_name(void)
     if (user_name[0] != 0)
         return (user_name);
 
-    pw = getpwuid(getuid());
+    pw = getpwuid(geteuid());
 
     if (pw != NULL) {
 	strncpy(user_name, pw->pw_name, 99);
@@ -224,7 +224,7 @@ gamin_check_secure_dir(void)
 	free(dir);
 	return(0);
     }
-    if (st.st_uid != getuid()) {
+    if (st.st_uid != geteuid()) {
 	gam_error(DEBUG_INFO,
 		  "Socket directory %s has different owner\n",
 		  dir);
@@ -301,7 +301,7 @@ gamin_check_secure_path(const char *path
     if (ret < 0)
 	return(0);
     
-    if (st.st_uid != getuid()) {
+    if (st.st_uid != geteuid()) {
 	gam_error(DEBUG_INFO,
 		  "Socket %s has different owner\n",
 		  path);
@@ -660,7 +660,7 @@ gamin_check_cred(GAMDataPtr conn, int fd
     } cmsg;
 #endif
 
-    s_uid = getuid();
+    s_uid = geteuid();
 
 #if defined(LOCAL_CREDS) && defined(HAVE_CMSGCRED)
     /* Set the socket to receive credentials on the next message */
diff -upr gamin-0.1.9/server/gam_channel.c gamin-0.1.9.euid/server/gam_channel.c
--- gamin-0.1.9/server/gam_channel.c	2007-07-04 22:36:49.000000000 +0900
+++ gamin-0.1.9.euid/server/gam_channel.c	2009-01-16 01:24:52.000000000 +0900
@@ -101,7 +101,7 @@ gam_client_conn_check_cred(GIOChannel * 
     } cmsg;
 #endif
 
-    s_uid = getuid();
+    s_uid = geteuid();
 
 #if defined(LOCAL_CREDS) && defined(HAVE_CMSGCRED)
     /* Set the socket to receive credentials on the next message */
@@ -442,7 +442,7 @@ create:
 		g_free(dir);
 		return(FALSE);
 	    }
-	    if (st.st_uid != getuid()) {
+	    if (st.st_uid != geteuid()) {
 		gam_error(DEBUG_INFO,
 		          "Socket directory %s has different owner\n",
 		          dir);
@@ -538,7 +538,7 @@ gam_check_secure_path(const char *path)
     if (ret < 0)
 	return(TRUE);
     
-    if (st.st_uid != getuid()) {
+    if (st.st_uid != geteuid()) {
 	gam_error(DEBUG_INFO,
 		  "Socket %s has different owner\n",
 		  path);
