![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| SUID not working | Pankaj Mishra | UNIX for Advanced & Expert Users | 3 | 10-20-2006 12:48 AM |
| SUID and SGID searching... | B14speedfreak | SUN Solaris | 2 | 05-23-2006 09:13 AM |
| is SUID disabled for shell | shriashishpatil | UNIX for Advanced & Expert Users | 3 | 03-22-2006 08:44 PM |
| what is suid ? | simon2000 | UNIX for Dummies Questions & Answers | 2 | 07-18-2002 06:43 AM |
| suid files??? | solvman | Security | 1 | 10-12-2001 10:51 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
#1
|
||||
|
||||
|
Hi all
I'm getting file info through stat( char *filename, struct stat *buf) Taking all the file attributes to buf->st_mode, How can i check the suid bit in there, if suid bit mask is 0004000?? Thank you all |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
Use the symbolic name rather than the octal constant. And use a bitwise "and":
Code:
if (buf->stmode & S_ISUID) {
printf{"suid bit set\n");
} else {
printf("suid bit clear\n");
}
if ((buf->stmode & S_ISUID) == S_ISUID) |
||||
| Google The UNIX and Linux Forums |