本文介绍了cuserid将su后的原始登录信息返回给另一个用户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Solaris 8系统上,如果用户joe例如,通过ssh登录,
cuserid()返回joe。这是预期的行为,到目前为止很好。

好​​。但是,如果那个用户那么:


%su - sally


cuserid仍将返回joe。然而,莎莉使用tcsh

whoami显示sally。如果运行为sally

的用户创建文件,则所有权为sally。 " ps -ef"

还显示用户shell运行为sally。虽然sally

printenv并且设置不显示任何joe分配。所有这些都是预期的

,除了当所有其他程序只看到sally时,cuserid()似乎挂在joe

上。


这是cuserid()的预期行为吗?


如果是这样,这是用于返回sally的正确函数
在su改为sally之后
帐号?


谢谢,


David Mathog

解决方案



(你将肯定会得到更多有用的回复

comp.unix.programmer,但FWIW我友好的男人页面说

cuserid()已经被getlogin()淘汰了,或者可能不是与您的情况相关的
。)


您的帖子对于comp.lang.c来说是偏离主题的。请访问






用于发布指南和常见问题解答。谢谢。


-

C. Benson Manica |我*应该*知道我在说什么 - 如果我

cbmanica(at)gmail.com |不,我需要知道。火焰欢迎。




(你肯定会得到更多有用的回复

comp.unix.programmer,但FWIW我友好的男人页面说

cuserid()已被getlogin()淘汰,可能与您的情况相关,也可能不是
。)



当然是太阳手册页上没有这样的说法,可能是因为那个版本时代的b $ b。 linux的人说,靠近底部,使用

getpwuid(geteuid())而不是使用cuserid()!


这带来一个有趣的观点,是否有一些简单的方法来确定给定C函数属于哪种语言标准(如果有的话)?
?在

这种情况​​下,linux手册页已经符合。

的条目给出了cuserid()的历史,但当然Sun页面说的是

什么都没有。一般来说,它们可能都已过时。

中的包含两个实例都是stdio.h,它没有提供关于函数是如何标准

的提示。如果没有通过该文件阅读,那就无法告诉我们什么语言状态。一个给定的函数有。


是否有一个网页,其中一个人可以打入一个C函数名称和

它将返回该函数的状态? ?例如,在

这种情况​​下它会显示如下:


cuserid:

系统V存在

POSIX于1988年添加

POSIX于1990年删除

ANSI C不存在


我不是想尝试用这些问题纠缠于错误的群体,通常不会因为我没有简单的方法来确定常见的C函数

是语言标准的一部分还是平台支持的一部分。


谢谢,


David Mathog


On a Solaris 8 system if a user "joe" logs in, for instance via ssh,
cuserid() returns "joe". That''s the expected behavior and so far so
good. However if that user then does:

% su - sally

cuserid will still return "joe". However "sally" uses "tcsh" where
whoami shows "sally". If the user running as "sally"
creates a file the ownership is for "sally". "ps -ef"
also shows the user shell running as "sally". While "sally"
printenv and set don''t show any "joe" assignments. All of this is
as expected except that cuserid() seems to hang onto "joe"
when all other programs see only "sally".

Is this the expected behavior of cuserid()?

If so, which is the proper function to use to return "sally"
following the su change to the "sally" account?

Thanks,

David Mathog

解决方案


(You will surely get much more helpful replies on
comp.unix.programmer, but FWIW my friendly man page says that
cuserid() has been obsoleted by getlogin(), which may or may not be
relevant to your situation.)

Your post is off-topic for comp.lang.c. Please visit

http://www.ungerhu.com/jxh/clc.welcome.txt
http://c-faq.com
http://benpfaff.org/writings/clc/off-topic.html

for posting guidelines and frequently asked questions. Thank you.

--
C. Benson Manica | I *should* know what I''m talking about - if I
cbmanica(at)gmail.com | don''t, I need to know. Flames welcome.



(You will surely get much more helpful replies on
comp.unix.programmer, but FWIW my friendly man page says that
cuserid() has been obsoleted by getlogin(), which may or may not be
relevant to your situation.)

Naturally the Sun man page says nothing like that, probably because
of the age of that release. The linux one says, near the bottom, to use
getpwuid(geteuid()) instead and not to use cuserid() at all!

This brings up an interesting point, is there some easy way to determine
which language standard (if any) a given C function belongs to? In
this case the linux man page has "conforming too" entries that
give a history of cuserid() but of course the Sun page says
nothing. In general they might both be out of date. The include in
both instances is "stdio.h", which gives no hint about how "standard"
the function is. Short of reading through that file there''s no way to
tell what language "status" a given function has.

Is there a web page where one can punch in a C function name and
it will return the status of that function??? For instance, in
this case it would show something like:

cuserid:
System V present
POSIX added in 1988
POSIX removed in 1990
ANSI C not present

I''m not trying to pester the wrong group with these questions, often
as not I just don''t have an easy way to determine if common C functions
are part of the language standard or part of the platform support.

Thanks,

David Mathog


这篇关于cuserid将su后的原始登录信息返回给另一个用户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-29 22:31