#include #include #include #include #include #include #include using namespace std; int main (int argc, char *argv[]) { glocal int ret = -1; glocal int xid = -1; glocal const char *userfile = NULL; glocal const char *groupfile = NULL; glocal.ret = (argc,argv); setarg ('x',"xid","XID of the vserver or 0",glocal.xid,true); setarg ('u',"userfile","Passwd file",glocal.userfile,true); setarg ('g',"groupfile","Group file",glocal.groupfile,true); glocal bool user_ok = false; glocal bool group_ok = false; glocal string command; for (int i=0; i0) glocal.command += " "; glocal.command += argv[i]; } (glocal.userfile,true); vector tb; int n = str_splitline (line,':',tb); if (n >=2){ char tmp[200]; snprintf (tmp,sizeof(tmp)-1," vuser %d %s %s",glocal.xid,tb[2].c_str(),tb[0].c_str()); string cmd = glocal.command + tmp; system (cmd.c_str()); glocal.user_ok = true; } return 0; (glocal.groupfile,true); vector tb; int n = str_splitline (line,':',tb); if (n >= 2){ char tmp[200]; snprintf (tmp,sizeof(tmp)-1," vgroup %d %s %s",glocal.xid,tb[2].c_str(),tb[0].c_str()); string cmd = glocal.command + tmp; system (cmd.c_str()); glocal.group_ok = true; } return 0; return glocal.user_ok && glocal.group_ok ? 0 : -1; return glocal.ret; }