On Friday 07 January 2005 16:58, Serge Hallyn wrote:
Attached is a first stab at setting loginuid through
/proc/$$/loginuid.
Compiled and tested here.
OK, spent some time looking at the patch & have some comments:
line 66:
+ length = snprintf((char *)page, count, "%u",
+ audit_loginuid(task->audit_context));
What if "audit_loginuid" returns a -1? How do we signify its not set. Besides,
-1 & %u don't get along.
line 77:
+ return length;
What if length is negative? Shouldn't this be an errno of some kind?
line 99:
+ length = -EFAULT;
What updates this? We always return -EFAULT.
line 103:
loginuid = simple_strtoul(page, &tmp, 10);
What about errors? For example, if they send -a123 usually you will get a 0
from stroul. Also, usually you want to convert the number back to a string
and compare to make sure all characters sent are convertable.
That's all I see...
-Steve