Changeset 481 for trunk/src/trustfile.c


Ignore:
Timestamp:
Jul 18, 2015, 5:06:52 PM (9 years ago)
Author:
katerina
Message:

Enhancements and fixes for tickets #374, #375, #376, #377, #378, and #379.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/trustfile.c

    r474 r481  
    102102
    103103
    104 #ifndef TRUST_MAIN
     104#if !defined(TRUST_MAIN)
    105105
    106106#include "slib.h"
     
    121121
    122122#define TRUST_DEBUG
    123 #define SL_FALSE 0
    124 #define SL_TRUE  1
     123#define S_FALSE 0
     124#define S_TRUE  1
    125125#define SL_ENTER(string)
    126126#define SL_IRETURN(a, b)  return a
     
    222222
    223223uid_t tf_euid = tf_uid_neg;
    224 int EUIDSLOT = sizeof(test_rootonly)/sizeof(uid_t);
    225 int ORIG_EUIDSLOT = sizeof(test_rootonly)/sizeof(uid_t);
     224unsigned int EUIDSLOT = sizeof(test_rootonly)/sizeof(uid_t);
     225unsigned int ORIG_EUIDSLOT = sizeof(test_rootonly)/sizeof(uid_t);
    226226
    227227char  tf_path[MAXFILENAME];             /* error path for trust function */
     
    381381  SL_ENTER(_("isin"));
    382382  if (list == NULL)
    383     SL_IRETURN(SL_FALSE, _("isin"));
     383    SL_IRETURN(S_FALSE, _("isin"));
    384384
    385385  while(*list != tf_uid_neg && *list != n)
     
    400400               (UID_CAST) n);
    401401#endif
    402       SL_IRETURN(SL_FALSE, _("isin"));
     402      SL_IRETURN(S_FALSE, _("isin"));
    403403    }
    404404
     
    408408           (UID_CAST)n, (UID_CAST)*list);
    409409#endif
    410   SL_IRETURN(SL_TRUE, _("isin"));
     410  SL_IRETURN(S_TRUE, _("isin"));
    411411}
    412412
     
    506506  if (pbuffer) free(pbuffer);
    507507#endif
    508   SL_IRETURN(SL_FALSE, _("isingrp"));
     508  SL_IRETURN(S_FALSE, _("isingrp"));
    509509
    510510 end_true:
     
    513513  if (pbuffer) free(pbuffer);
    514514#endif
    515   SL_IRETURN(SL_TRUE, _("isingrp"));
     515  SL_IRETURN(S_TRUE, _("isingrp"));
    516516}
    517517
     
    537537#endif
    538538
    539   int retval = SL_FALSE;
     539  int retval = S_FALSE;
    540540
    541541  SL_ENTER(_("onlytrustedingrp"));
     
    567567              (UID_CAST)grp);
    568568#endif
    569       retval = SL_FALSE;
     569      retval = S_FALSE;
    570570      goto end_retval;
    571571    }
     
    574574   
    575575  if(g->gr_mem == NULL || g->gr_mem[0] == NULL )
    576     SL_IRETURN(SL_TRUE, _("onlytrustedingrp") );
     576    SL_IRETURN(S_TRUE, _("onlytrustedingrp") );
    577577  */
    578578
     
    640640#endif
    641641          tf_baduid = w->pw_uid;
    642           retval = SL_FALSE;
     642          retval = S_FALSE;
    643643#if defined(HAVE_PTHREAD) && defined (_POSIX_THREAD_SAFE_FUNCTIONS) && defined(HAVE_GETGRGID_R)
    644644          if (pbuffer) free(pbuffer);
     
    698698#endif
    699699              tf_baduid = w->pw_uid;
    700               retval = SL_FALSE;
     700              retval = S_FALSE;
    701701              goto out;
    702               /* SL_IRETURN(SL_FALSE, _("onlytrustedingrp")); */
    703             }
    704         }
    705     }
    706   retval = SL_TRUE;
     702              /* SL_IRETURN(S_FALSE, _("onlytrustedingrp")); */
     703            }
     704        }
     705    }
     706  retval = S_TRUE;
    707707
    708708 out:
     
    720720
    721721#ifdef TRUST_DEBUG
    722   if (retval == SL_TRUE)
     722  if (retval == S_TRUE)
    723723    fprintf(stderr,
    724724            "trustfile: group %ld:  all members are trusted users --> OK\n",
     
    849849          char * csym;                  /* contents of symlink file  */
    850850          char * full;                  /* "full" name of symlink    */
    851           register char *b, *t;         /* used to copy stuff around */
    852           register int lsym;            /* num chars in symlink ref  */
    853           register int i;               /* trustworthy or not?       */
     851          char *b;                      /* used to copy stuff around */
     852          const char *t;                /* used to copy stuff around */
     853          int lsym;                     /* num chars in symlink ref  */
     854          int i;                        /* trustworthy or not?       */
    854855          const char * t_const;
    855856          char *end;
     
    915916              /* smack on the /../
    916917               */
    917               t_const = "/../"; t = (char *)t_const;
     918              t_const = "/../"; t = (const char *)t_const;
    918919              while(*t && b < end)
    919920                *b++ = *t++;
     
    997998       * file regardless of permissions, so bomb
    998999       */
    999       if (((okusers != NULL && SL_FALSE == isin((uid_t)stbuf.st_uid,okusers))||
    1000            (badusers != NULL && SL_TRUE == isin((uid_t)stbuf.st_uid,badusers))))
     1000      if (((okusers != NULL && S_FALSE == isin((uid_t)stbuf.st_uid,okusers))||
     1001           (badusers != NULL && S_TRUE == isin((uid_t)stbuf.st_uid,badusers))))
    10011002        {
    10021003#ifdef TRUST_DEBUG
Note: See TracChangeset for help on using the changeset viewer.