Changeset 513


Ignore:
Timestamp:
Oct 20, 2016, 7:12:19 PM (8 years ago)
Author:
katerina
Message:

Fix for ticket #406 (wrong path in error message).

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/docs/Changelog

    r512 r513  
    114.1.6:
     2        * fix minor bug in error message (tf_trust_errfile needs copy to
     3        keep relevant value).
    24        * fix SH_DEADFILE (too big, some architectures have nlink_t
    35        as uint16, e.g. FreeBSD).
  • trunk/src/sh_unix.c

    r497 r513  
    12101210  int    level;
    12111211  uid_t  ff_euid = (uid_t) -1;
     1212  uid_t  baduid;
     1213  gid_t  badgid;
    12121214
    12131215  SL_ENTER(_("tf_trust_check"));
     
    12561258        level = SH_ERR_ERR;
    12571259
    1258       tmp  = sh_util_safe_name (file);
    1259       p    = sl_trust_errfile();
     1260      tmp    = sh_util_safe_name (file);
     1261      p      = sh_util_strdup(sl_trust_errfile());
     1262      baduid = sl_trust_baduid();
     1263      badgid = sl_trust_badgid();
     1264     
    12601265      if (p && *p != '\0')
    12611266        {
    1262           tmp2  = sh_util_safe_name (sl_trust_errfile());
     1267          tmp2  = sh_util_safe_name (p);
    12631268          sh_error_handle(level, FIL__, __LINE__, status, MSG_E_TRUST2,
    12641269                          sl_error_string(status), tmp, tmp2);
     
    12701275                          sl_error_string(status), tmp);
    12711276        }
    1272       SH_FREE(tmp);
    12731277
    12741278      if (status == SL_EBADUID   || status == SL_EBADGID ||
     
    12821286            break;
    12831287          case SL_ETRUNC:
    1284             tmp  = sh_util_safe_name (file);
    12851288            dlog(1, FIL__, __LINE__,
    12861289                 _("A filename truncation occured in the trustfile function.\nProbably the normalized filename for %s\nis too long. This may be due e.g. to deep or circular softlinks.\n"),
    12871290                 tmp);
    1288             SH_FREE(tmp);
    12891291            break;
    12901292          case SL_EBADOTH:
    1291             tmp  = sh_util_safe_name (file);
    1292             p    = sl_trust_errfile();
    12931293            dlog(1, FIL__, __LINE__,
    12941294                 _("The path element: %s\nin the filename: %s is world writeable.\n"),
    1295                  p, tmp);
    1296             SH_FREE(tmp);
     1295                 (p) ? p : _("(null)"), tmp);
    12971296            break;
    12981297          case SL_EBADUID:
    1299             tmp  = sh_util_safe_name (file);
    1300             p    = sl_trust_errfile();
    13011298            dlog(1, FIL__, __LINE__,
    13021299                 _("The owner (UID = %ld) of the path element: %s\nin the filename: %s\nis not in the list of trusted users.\nTo fix the problem, you can:\n - run ./configure again with the option --with-trusted=0,...,UID\n   where UID is the UID of the untrusted user, or\n - use the option TrustedUser=UID in the configuration file.\n"),
    1303                  (UID_CAST)sl_trust_baduid(), p, tmp);
    1304             SH_FREE(tmp);
     1300                 (UID_CAST)baduid, (p) ? p : _("(null)"), tmp);
    13051301            break;
    13061302          case SL_EBADGID:
    1307             tmp  = sh_util_safe_name (file);
    1308             p    = sl_trust_errfile();
    13091303            dlog(1, FIL__, __LINE__,
    13101304                 _("The path element: %s\nin the filename: %s\nis group writeable (GID = %ld), and at least one of the group\nmembers (UID = %ld) is not in the list of trusted users.\nTo fix the problem, you can:\n - run ./configure again with the option --with-trusted=0,...,UID\n   where UID is the UID of the untrusted user, or\n - use the option TrustedUser=UID in the configuration file.\n"),
    1311                  p, tmp, (UID_CAST)sl_trust_badgid(),
    1312                  (UID_CAST)sl_trust_baduid());
    1313             SH_FREE(tmp);
     1305                 (p) ? p : _("(null)"), tmp, (UID_CAST)badgid,
     1306                 (UID_CAST)baduid);
    13141307            break;
    13151308          default:
    13161309            break;
    13171310          }
    1318            
     1311          SH_FREE(tmp);
     1312          if (p) SH_FREE(p);
    13191313          SL_RETURN((-1), _("tf_trust_check"));
    13201314        }
     1315      else {
     1316        SH_FREE(tmp);
     1317        if (p) SH_FREE(p);
     1318      }
    13211319    }
    13221320
Note: See TracChangeset for help on using the changeset viewer.