]> granicus.if.org Git - linux-pam/blobdiff - modules/pam_rhosts/pam_rhosts_auth.c
Relevant BUGIDs:
[linux-pam] / modules / pam_rhosts / pam_rhosts_auth.c
index 7266b4e838fd1f6cd5c1edf3653818e789bd1c9c..374318dcc777293475a3dd7505239c96f58f10a0 100644 (file)
@@ -42,7 +42,7 @@
 
 #define USER_RHOSTS_FILE "/.rhosts"     /* prefixed by user's home dir */
 
-#ifdef linux
+#ifdef __linux__
 #include <endian.h>
 #endif
 
@@ -74,19 +74,13 @@ int innetgr(const char *, const char *, const char *,const char *);
 #include <ctype.h>
 
 #include <net/if.h>
-#ifdef linux
-# include <linux/sockios.h>
-# ifndef __USE_MISC
-#  define __USE_MISC
-#  include <sys/fsuid.h>
-# endif /* __USE_MISC */
-#endif
 
 #include <pwd.h>
 #include <grp.h>
 #include <sys/file.h>
 #include <sys/signal.h>
 #include <sys/stat.h>
+#include <stdint.h>
 #include <syslog.h>
 #ifndef _PATH_HEQUIV
 #define _PATH_HEQUIV "/etc/hosts.equiv"
@@ -98,8 +92,9 @@ int innetgr(const char *, const char *, const char *,const char *);
 #include <security/_pam_macros.h>
 #include <security/_pam_modutil.h>
 
-/* to the best of my knowledge, all modern UNIX boxes have 32 bit integers */
-#define U32 unsigned int
+/* Use the C99 type; older platforms will need this to be typedef'ed
+   elsewhere */
+#define U32 uint32_t
 
 
 /*
@@ -520,7 +515,7 @@ pam_iruserok(pam_handle_t *pamh,
      */
 
     /* We are root, this will not fail */
-#ifdef linux
+#ifdef __linux__
     /* If we are on linux the better way is setfsuid */
     uid = setfsuid(pwd->pw_uid);
     hostf = fopen(pbuf, "r");
@@ -555,7 +550,7 @@ pam_iruserok(pam_handle_t *pamh,
 
        /* private group caveat */
        if (opts->opt_private_group) {
-           struct group *grp = getgrgid(sbuf.st_gid);
+           struct group *grp = _pammodutil_getgrgid(pamh, sbuf.st_gid);
 
            if (NULL == grp || NULL == grp->gr_name
                || strcmp(luser,grp->gr_name)) {
@@ -596,7 +591,7 @@ exit_function:
      * they are reset before we exit.
      */
 
-#ifdef linux
+#ifdef __linux__
     setfsuid(uid);
 #else
     (void)seteuid(uid);