ALT Linux Team development discussions
 help / color / mirror / Atom feed
* [devel] suid/sgid programs and temporary files
@ 2005-08-16 19:31 Alexey Tourbin
  2005-08-16 19:56 ` Dmitry V. Levin
  0 siblings, 1 reply; 18+ messages in thread
From: Alexey Tourbin @ 2005-08-16 19:31 UTC (permalink / raw)
  To: devel

[-- Attachment #1: Type: text/plain, Size: 1627 bytes --]

В /usr/lib/perl5/File/Temp.pm есть функция проверки временного каталога,
в котором будут созданы временные файлы.

   649  # internal routine to check to see if the directory is safe
   650  # First checks to see if the directory is not owned by the
   651  # current user or root. Then checks to see if anyone else
   652  # can write to the directory and if so, checks to see if
   653  # it has the sticky bit set
...
   668  sub _is_safe {
   669
   670    my $path = shift;
   671    my $err_ref = shift;
   672
   673    # Stat path
   674    my @info = stat($path);
   675    unless (scalar(@info)) {
   676      $$err_ref = "stat(path) returned no values";
   677      return 0;
   678    };
   679    return 1 if $^O eq 'VMS';  # owner delete control at file level
   680
   681    # Check to see whether owner is neither superuser (or a system uid) nor me
   682    # Use the real uid from the $< variable
   683    # UID is in [4]
   684    if ($info[4] > File::Temp->top_system_uid() && $info[4] != $<) {
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   685
   686      Carp::cluck(sprintf "uid=$info[4] topuid=%s \$<=$< path='$path'",
   687                  File::Temp->top_system_uid());
   688
   689      $$err_ref = "Directory owned neither by root nor the current user"
   690        if ref($err_ref);
   691      return 0;
   692    }
...

Условия подчеркнутой проверки можно перевести примерно как
	st.st_uid > 10 && st.st_uid != getuid()

Вопрос: хорошо ли, что здесь используется real uid?  Не лучше ли
проверять effective uid? 

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2005-08-17  7:14 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-08-16 19:31 [devel] suid/sgid programs and temporary files Alexey Tourbin
2005-08-16 19:56 ` Dmitry V. Levin
2005-08-16 21:42   ` [devel] " Alexey Tourbin
2005-08-16 22:06     ` Dmitry V. Levin
2005-08-16 22:34       ` Alexey Tourbin
2005-08-16 22:50         ` Dmitry V. Levin
2005-08-16 23:33           ` Alexey Tourbin
2005-08-16 23:38             ` Dmitry V. Levin
2005-08-16 23:52               ` Alexey Tourbin
2005-08-17  7:14         ` [devel] [wiki] " Michael Shigorin
2005-08-16 22:44       ` [devel] " Alexey Tourbin
2005-08-16 22:55         ` Dmitry V. Levin
2005-08-16 23:20           ` Alexey Tourbin
2005-08-16 23:30             ` Alexey Tourbin
2005-08-17  0:37               ` Alexey Tourbin
2005-08-17  0:46                 ` Alexey Tourbin
2005-08-17  3:02           ` Andrey Rahmatullin
2005-08-17  6:37             ` Alexey Tourbin

ALT Linux Team development discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/devel/0 devel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 devel devel/ http://lore.altlinux.org/devel \
		devel@altlinux.org devel@altlinux.ru devel@lists.altlinux.org devel@lists.altlinux.ru devel@linux.iplabs.ru mandrake-russian@linuxteam.iplabs.ru sisyphus@linuxteam.iplabs.ru
	public-inbox-index devel

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.devel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git