Changeset 534


Ignore:
Timestamp:
Sep 16, 2018, 8:56:38 PM (3 years ago)
Author:
katerina
Message:

Version 4.3.0, support for /etc/subuid, /etc/subgid

Location:
trunk
Files:
1 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Makefile.in

    r532 r534  
    128128        sh_restrict.h sh_sub.h sh_fInotify.h sh_checksum.h \
    129129        sh_dbIO.h sh_dbIO_int.h sh_guid.h sh_dbCheck.h sh_dbCreate.h \
    130         sh_sem.h
     130        sh_sem.h sh_subuid.h
    131131
    132132
     
    175175        $(srcsrc)/sh_checksum.c $(srcsrc)/sh_guid.c $(srcsrc)/sh_sem.c \
    176176        $(srcsrc)/sh_dbIO.c $(srcsrc)/sh_dbCheck.c  $(srcsrc)/sh_dbCreate.c \
     177        $(srcsrc)/sh_subuid.c \
    177178        $(srcsrc)/t-test1.c
    178179
     
    197198        sh_audit.o sh_registry.o sh_ipvx.o sh_restrict.o \
    198199        sh_filetype.o sh_sub.o sh_fInotify.o sh_checksum.o \
    199         sh_guid.o sh_sem.o sh_dbIO.o sh_dbCheck.o sh_dbCreate.o
     200        sh_guid.o sh_sem.o sh_dbIO.o sh_dbCheck.o sh_dbCreate.o \
     201        sh_subuid.o
    200202
    201203
     
    16311633
    16321634samhain.o: $(srcsrc)/samhain.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_pthread.h $(srcinc)/sh_utils.h $(srcinc)/sh_error.h $(srcinc)/sh_unix.h $(srcinc)/sh_files.h $(srcinc)/sh_getopt.h $(srcinc)/sh_readconf.h $(srcinc)/sh_hash.h $(srcinc)/sh_dbIO.h $(srcinc)/sh_restrict.h $(srcinc)/sh_nmail.h $(srcinc)/sh_tiger.h $(srcinc)/sh_gpg.h $(srcinc)/sh_mem.h $(srcinc)/sh_xfer.h $(srcinc)/sh_tools.h $(srcinc)/sh_hash.h $(srcinc)/sh_extern.h $(srcinc)/sh_modules.h $(srcinc)/sh_ignore.h $(srcinc)/sh_prelink.h $(srcinc)/sh_sem.h sh_MK.h $(srcinc)/sh_schedule.h
    1633 sh_unix.o: $(srcsrc)/sh_unix.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_error.h $(srcinc)/sh_unix.h $(srcinc)/sh_utils.h $(srcinc)/sh_mem.h $(srcinc)/sh_hash.h $(srcinc)/sh_tools.h $(srcinc)/sh_restrict.h $(srcinc)/sh_ipvx.h $(srcinc)/sh_tiger.h $(srcinc)/sh_prelink.h $(srcinc)/sh_pthread.h $(srcinc)/sh_sem.h $(srcinc)/sh_static.h $(srcinc)/sh_prelude.h $(srcinc)/zAVLTree.h $(srcinc)/sh_ignore.h
     1635sh_unix.o: $(srcsrc)/sh_unix.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_error.h $(srcinc)/sh_unix.h $(srcinc)/sh_utils.h $(srcinc)/sh_mem.h $(srcinc)/sh_hash.h $(srcinc)/sh_tools.h $(srcinc)/sh_restrict.h $(srcinc)/sh_ipvx.h $(srcinc)/sh_tiger.h $(srcinc)/sh_prelink.h $(srcinc)/sh_pthread.h $(srcinc)/sh_sem.h $(srcinc)/sh_static.h $(srcinc)/sh_prelude.h $(srcinc)/zAVLTree.h $(srcinc)/sh_subuid.h $(srcinc)/sh_ignore.h
    16341636sh_utils.o: $(srcsrc)/sh_utils.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_error.h $(srcinc)/sh_utils.h $(srcinc)/sh_unix.h $(srcinc)/sh_tiger.h $(srcinc)/sh_entropy.h $(srcinc)/sh_pthread.h
    16351637sh_error.o: $(srcsrc)/sh_error.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_cat.h $(srcinc)/sh_database.h $(srcinc)/sh_error.h $(srcinc)/sh_utils.h $(srcinc)/sh_unix.h $(srcinc)/sh_tiger.h $(srcinc)/sh_nmail.h $(srcinc)/sh_xfer.h $(srcinc)/sh_prelude.h $(srcinc)/sh_pthread.h $(srcinc)/sh_tools.h $(srcinc)/sh_extern.h $(srcinc)/sh_checksum.h
     
    17271729sh_xload_client.o: $(srcsrc)/sh_xload_client.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_utils.h $(srcinc)/sh_fifo.h $(srcinc)/sh_guid.h
    17281730sh_sem.o: $(srcsrc)/sh_sem.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_sem.h $(srcinc)/sh_error_min.h
     1731sh_subuid.o: $(srcsrc)/sh_subuid.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_unix.h
  • trunk/config.h.in

    r522 r534  
    907907/* Define to 1 if you have the <sys/stat.h> header file. */
    908908#undef HAVE_SYS_STAT_H
     909
     910/* Define to 1 if you have the <sys/sysmacros.h> header file. */
     911#undef HAVE_SYS_SYSMACROS_H
    909912
    910913/* Define to 1 if you have the <sys/types.h> header file. */
  • trunk/configure.ac

    r531 r534  
    1212dnl start
    1313dnl
    14 AM_INIT_AUTOMAKE(samhain, 4.2.4)
     14AM_INIT_AUTOMAKE(samhain, 4.3.0)
    1515AC_DEFINE([SAMHAIN], 1, [Application is samhain])
    1616AC_CANONICAL_HOST
     
    244244
    245245AC_CHECK_HEADERS(stddef.h libgen.h sched.h malloc.h sys/uio.h \
    246         sys/mman.h sys/param.h sys/inotify.h \
     246        sys/mman.h sys/param.h sys/inotify.h sys/sysmacros.h \
    247247        sys/vfs.h mntent.h \
    248248        sys/select.h sys/socket.h netinet/in.h ifaddrs.h \
  • trunk/depend.dep

    r481 r534  
    22# DO NOT DELETE THIS LINE
    33samhain.o: $(srcsrc)/samhain.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_pthread.h $(srcinc)/sh_utils.h $(srcinc)/sh_error.h $(srcinc)/sh_unix.h $(srcinc)/sh_files.h $(srcinc)/sh_getopt.h $(srcinc)/sh_readconf.h $(srcinc)/sh_hash.h $(srcinc)/sh_dbIO.h $(srcinc)/sh_restrict.h $(srcinc)/sh_nmail.h $(srcinc)/sh_tiger.h $(srcinc)/sh_gpg.h $(srcinc)/sh_mem.h $(srcinc)/sh_xfer.h $(srcinc)/sh_tools.h $(srcinc)/sh_hash.h $(srcinc)/sh_extern.h $(srcinc)/sh_modules.h $(srcinc)/sh_ignore.h $(srcinc)/sh_prelink.h $(srcinc)/sh_sem.h sh_MK.h $(srcinc)/sh_schedule.h
    4 sh_unix.o: $(srcsrc)/sh_unix.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_error.h $(srcinc)/sh_unix.h $(srcinc)/sh_utils.h $(srcinc)/sh_mem.h $(srcinc)/sh_hash.h $(srcinc)/sh_tools.h $(srcinc)/sh_restrict.h $(srcinc)/sh_ipvx.h $(srcinc)/sh_tiger.h $(srcinc)/sh_prelink.h $(srcinc)/sh_pthread.h $(srcinc)/sh_sem.h $(srcinc)/sh_static.h $(srcinc)/sh_prelude.h $(srcinc)/zAVLTree.h $(srcinc)/sh_ignore.h
     4sh_unix.o: $(srcsrc)/sh_unix.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_error.h $(srcinc)/sh_unix.h $(srcinc)/sh_utils.h $(srcinc)/sh_mem.h $(srcinc)/sh_hash.h $(srcinc)/sh_tools.h $(srcinc)/sh_restrict.h $(srcinc)/sh_ipvx.h $(srcinc)/sh_tiger.h $(srcinc)/sh_prelink.h $(srcinc)/sh_pthread.h $(srcinc)/sh_sem.h $(srcinc)/sh_static.h $(srcinc)/sh_prelude.h $(srcinc)/zAVLTree.h $(srcinc)/sh_subuid.h $(srcinc)/sh_ignore.h
    55sh_utils.o: $(srcsrc)/sh_utils.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_error.h $(srcinc)/sh_utils.h $(srcinc)/sh_unix.h $(srcinc)/sh_tiger.h $(srcinc)/sh_entropy.h $(srcinc)/sh_pthread.h
    66sh_error.o: $(srcsrc)/sh_error.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_cat.h $(srcinc)/sh_database.h $(srcinc)/sh_error.h $(srcinc)/sh_utils.h $(srcinc)/sh_unix.h $(srcinc)/sh_tiger.h $(srcinc)/sh_nmail.h $(srcinc)/sh_xfer.h $(srcinc)/sh_prelude.h $(srcinc)/sh_pthread.h $(srcinc)/sh_tools.h $(srcinc)/sh_extern.h $(srcinc)/sh_checksum.h
     
    100100sh_xload_client.o: $(srcsrc)/sh_xload_client.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_utils.h $(srcinc)/sh_fifo.h $(srcinc)/sh_guid.h
    101101sh_sem.o: $(srcsrc)/sh_sem.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_sem.h $(srcinc)/sh_error_min.h
     102sh_subuid.o: $(srcsrc)/sh_subuid.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_unix.h
  • trunk/depend.sum

    r481 r534  
    1 2959213307
     13903466696
  • trunk/docs/Changelog

    r533 r534  
     14.3.0:
     2        * add support for /etc/subuid, /etc/subgid maps
     3        * fix compiler warning on Ubuntu 18.04
     4
    154.2.4:
    26        * fix 'clobbered by..' compiler warning is src/sh_portcheck.c
  • trunk/src/sh_hash.c

    r516 r534  
    2424#include <stdio.h>
    2525#include <sys/types.h>
     26#ifdef HAVE_SYS_SYSMACROS_H
     27#include <sys/sysmacros.h>
     28#endif
    2629#include <sys/stat.h>
    2730#include <unistd.h>
  • trunk/src/sh_unix.c

    r516 r534  
    28272827
    28282828/* --------- end caching code --------- */
    2829  
     2829
     2830#include "sh_subuid.h"
     2831
    28302832char *  sh_unix_getUIDname (int level, uid_t uid, char * out, size_t len)
    28312833{
     
    28632865  status = errno;
    28642866#endif
    2865  
    2866   if (tempres == NULL)
    2867     {
    2868       sh_error_handle (level, FIL__, __LINE__, EINVAL, MSG_E_PWNULL,
    2869                        sh_error_message(status, errbuf, sizeof(errbuf)),
    2870                        _("getpwuid"), (long) uid, _("completely missing"));
    2871 #if defined(HAVE_PTHREAD) && defined (_POSIX_THREAD_SAFE_FUNCTIONS) && defined(HAVE_GETGRGID_R)
    2872       SH_FREE(buffer);
    2873 #endif
    2874       sh_userid_add(uid, NULL, CACHE_UID);
    2875       SL_RETURN( NULL, _("sh_unix_getUIDname"));
    2876     }
    2877 
    2878 
    2879   if (tempres->pw_name != NULL)
     2867
     2868  /* case 1: we have it
     2869   */
     2870  if (tempres && tempres->pw_name != NULL)
    28802871    {
    28812872
     
    28882879
    28892880      SL_RETURN( out, _("sh_unix_getUIDname"));
    2890     }
    2891   else
    2892     {
     2881    }
     2882
     2883#if defined(HAVE_PTHREAD) && defined (_POSIX_THREAD_SAFE_FUNCTIONS) && defined(HAVE_GETGRGID_R)
     2884  SH_FREE(buffer);
     2885#endif
     2886 
     2887  if (tempres == NULL)
     2888    {
     2889      char * pwname = sh_get_subuid ((unsigned long) uid);
     2890
     2891      if (pwname)
     2892        {
     2893          sl_strlcpy(out, pwname, len);
     2894          sh_userid_add(uid, out, CACHE_UID);
     2895          SL_RETURN( out, _("sh_unix_getUIDname"));
     2896        }
     2897
    28932898      sh_error_handle (level, FIL__, __LINE__, EINVAL, MSG_E_PWNULL,
    28942899                       sh_error_message(status, errbuf, sizeof(errbuf)),
    2895                        _("getpwuid"), (long) uid, _("pw_user"));
    2896 #if defined(HAVE_PTHREAD) && defined (_POSIX_THREAD_SAFE_FUNCTIONS) && defined(HAVE_GETGRGID_R)
    2897       SH_FREE(buffer);
    2898 #endif
     2900                       _("getpwuid"), (long) uid, _("completely missing"));
     2901      sh_userid_add(uid, NULL, CACHE_UID);
    28992902      SL_RETURN( NULL, _("sh_unix_getUIDname"));
    29002903    }
    2901   /* notreached */
     2904
     2905
     2906  /* getwpuid returns struct, but no pw_name
     2907   */
     2908  sh_error_handle (level, FIL__, __LINE__, EINVAL, MSG_E_PWNULL,
     2909                   sh_error_message(status, errbuf, sizeof(errbuf)),
     2910                   _("getpwuid"), (long) uid, _("pw_user"));
     2911  SL_RETURN( NULL, _("sh_unix_getUIDname"));
    29022912}
    29032913
     
    29592969    }
    29602970
    2961   if (tempres == NULL)
    2962     {
    2963       sh_error_handle (level, FIL__, __LINE__, EINVAL, MSG_E_GRNULL,
    2964                        sh_error_message(status, errbuf, sizeof(errbuf)),
    2965                        _("getgrgid"), (long) gid, _("completely missing"));
    2966      
    2967 #if defined(HAVE_PTHREAD) && defined (_POSIX_THREAD_SAFE_FUNCTIONS) && defined(HAVE_GETGRGID_R)
    2968       SH_FREE(buffer);
    2969 #endif
    2970 
    2971       sh_userid_add(gid, NULL, CACHE_GID);
    2972       SL_RETURN( NULL, _("sh_unix_getGIDname"));
    2973     }
    2974 
    2975   if (tempres->gr_name != NULL)
     2971  if (tempres && tempres->gr_name != NULL)
    29762972    {
    29772973
     
    29852981      SL_RETURN( out, _("sh_unix_getGIDname"));
    29862982    }
    2987   else
    2988     {
     2983
     2984#if defined(HAVE_PTHREAD) && defined (_POSIX_THREAD_SAFE_FUNCTIONS) && defined(HAVE_GETGRGID_R)
     2985  SH_FREE(buffer);
     2986#endif
     2987
     2988  if (tempres == NULL)
     2989    {
     2990      char * grname = sh_get_subgid ((unsigned long) gid);
     2991
     2992      if (grname)
     2993        {
     2994          sl_strlcpy(out, grname, len);
     2995          sh_userid_add((uid_t)gid, out, CACHE_GID);
     2996          SL_RETURN( out, _("sh_unix_getGIDname"));
     2997        }
     2998
    29892999      sh_error_handle (level, FIL__, __LINE__, EINVAL, MSG_E_GRNULL,
    29903000                       sh_error_message(status, errbuf, sizeof(errbuf)),
    2991                        _("getgrgid"), (long) gid, _("gr_name"));
    2992 
    2993 #if defined(HAVE_PTHREAD) && defined (_POSIX_THREAD_SAFE_FUNCTIONS) && defined(HAVE_GETGRGID_R)
    2994       SH_FREE(buffer);
    2995 #endif
    2996 
     3001                       _("getgrgid"), (long) gid, _("completely missing"));
     3002      sh_userid_add(gid, NULL, CACHE_GID);
    29973003      SL_RETURN( NULL, _("sh_unix_getGIDname"));
    29983004    }
    2999   /* notreached */
     3005
     3006  sh_error_handle (level, FIL__, __LINE__, EINVAL, MSG_E_GRNULL,
     3007                   sh_error_message(status, errbuf, sizeof(errbuf)),
     3008                   _("getgrgid"), (long) gid, _("gr_name"));
     3009  SL_RETURN( NULL, _("sh_unix_getGIDname"));
    30003010}
    30013011
     
    30663076}
    30673077
    3068 
     3078/* return >0 on success, -1 on EOF */
    30693079int sh_unix_getline (SL_TICKET fd, char * line, int sizeofline)
    30703080{
Note: See TracChangeset for help on using the changeset viewer.