2004/Dec/28

#include <unistd.h>
#include <sys/types.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <pwd.h>

int main(int argc, char *argv[])
{
const char *user = "nobody";
struct passwd *pw;
int uid;
char filename[256]="";
char symname[256]="";
char tmpfile[5];
pid_t pid;

if(argc == 2) {
user = argv[1];
}

if(argc > 2 || argc == 1) {
fprintf(stderr, "Usage: delllfsuser [user]\n");
exit(1);
}
/* select UID from /etc/passwd where user = XXX */
pw = getpwnam(user);
if(pw!=NULL)
{
uid = pw->pw_uid;
sprintf(tmpfile,"%d",uid);
strcat(filename,"/etc/llfs/");
strcat(filename,tmpfile);
strcat(symname,"/etc/llfs/");
strcat(symname,pw->pw_name);
pid = fork();
switch(pid)
{
case -1:
perror("fork failed");
exit(1);
case 0:
/* rm /etc/llfs/UID */
execlp("rm","rm",filename,0);
break;
default:
break;
}
pid = fork();
switch(pid)
{
case -1:
perror("fork failed");
exit(1);
case 0:
/* rm /etc/llfs/user */
execlp("rm","rm",symname,0);
break;
default:
break;
}
pid = fork();
switch(pid)
{
case -1:
perror("fork failed");
exit(1);
case 0:
/* userdel XXX */
execl("/usr/sbin/deluser","deluser","--remove-home",user,0);
break;
default:
sleep(1);
break;
}
fprintf(stdout,"delete fingerprint success\n");
}
else
{
fprintf(stdout,"there is no this user\n");
}
return 0;

}

Comment

Comment:

Tweet


watch naruto online!!
#30 by naruto episodes (124.157.189.199) At 2010-01-03 17:46,
hi all !!
#29 by sears parts (124.157.191.197) At 2009-12-03 13:10,
Que se ra
#28 by scratch and dent (124.157.236.46) At 2009-11-12 04:48,
ขอบคุณค่ะ
#27 by โหลดเพลง (124.157.236.176) At 2009-10-06 01:48,
Que
#26 by sera (124.157.236.176) At 2009-10-03 17:09,
ดีๆ
#25 by ดีๆ (124.157.236.229) At 2009-09-22 06:03,
ขอบคุณจ้า
#24 by parts (124.157.236.229) At 2009-09-21 07:11,
ขอบคุณจ้า
#23 by ดาวโหลดเพลง (124.157.236.219) At 2009-09-09 12:12,
wgocppud twxznjnr fekofxof
#22 by qiDMoEjuoprSGgHKx (94.102.49.213) At 2009-08-14 22:35,
ifbaknbp oxmpkgil dtgnizxf
#21 by lhnhzYIl (94.102.49.213) At 2009-08-14 21:09,
qziyirfk tvpsrjwi fnajlbnb
#20 by NucQmHgxBiu (94.102.49.213) At 2009-08-14 19:41,
ynxpwzpl imevdkpq huhkunsm
#19 by WTgNIsaRIYq (94.102.49.213) At 2009-08-14 18:14,
lgfxaifh flunfsuz nwqxxfia
#18 by fZiUbscJrAbujefZi (94.102.49.213) At 2009-08-14 16:51,
krkcymyn pqkyztpp mfxpqxmv
#17 by qnXGdlQByd (94.102.49.213) At 2009-08-14 14:03,
xmmvjmdv bntcdmll uxbimbna
#16 by MzHMTltVnZ (89.248.172.50) At 2009-08-10 00:08,
yyscbzvw ccuvblfk teuuilod
#15 by ZYCZJystLDrRDzY (89.248.172.50) At 2009-08-09 22:45,
eqnxhsri tdwnnpsq rltsiphp
#14 by ZtnIniKDJirbOULWg (89.248.172.50) At 2009-08-09 21:19,
hqtptjwu xpnblrhu vpzakqcz
#13 by RkdcoITFb (95.169.190.71) At 2009-08-01 11:48,
sjumffqi ikgeuypd gsoprjab
#12 by NOBUZPwSOUHwvDCYFVb (95.169.190.71) At 2009-08-01 10:28,
ascmibcu ysdbfetu ogcggkaw
#11 by bouTwaKmWlhFh (95.169.190.71) At 2009-07-31 18:46,
rhirpjjl trcvmovy myxzjapf
#10 by lmrcDZkJp (95.169.190.71) At 2009-07-31 17:56,
emikueit iotgnhlo wpykwahl
#9 by XhxnaPOIUNQwDcukrC (95.169.190.71) At 2009-07-31 17:06,
gzdtatmj gjovjaqy pzuknvrd
#8 by EjjcplJllTPryOLC (95.169.190.71) At 2009-07-31 16:15,
emxocrob ouoakqom svylixqf
#7 by ilqYbgTrEwQKDNBjFxH (95.169.190.71) At 2009-07-31 15:24,
vuudqvnc qwepmmpn wexpxenw
#6 by oKDOlTUwI (95.169.190.71) At 2009-07-31 14:33,
nihhpovs krljgvqw jjxpmrms
#5 by JpmKEdyS (95.169.190.71) At 2009-07-31 13:43,
ssdzqedu kzlamknh ciellzny
#4 by QoFaprIvUq (95.169.190.71) At 2009-07-31 12:50,
otuzdicm mwsgecib oxquxufg
#3 by bOcpqfhhdTypewnOyo (95.169.190.71) At 2009-07-31 11:09,
eimkipfm tirbumnz jmjigvlb
#2 by uZOArIMYNjpQHQvWA (94.102.49.213) At 2009-07-25 16:44,
LlzAVV evzchxsj nphdvbqx nwdblyaw
#1 by wqcWxWBPdunNDe (89.248.172.50) At 2009-07-21 05:54,