- moved IFServerOption to ifile.c
- moved PWSicsUser to passwd.c - moved back InitObjectCommands to ofac.c
This commit is contained in:
37
passwd.c
37
passwd.c
@ -44,6 +44,7 @@
|
||||
#include <assert.h>
|
||||
#include "passwd.h"
|
||||
#include "splitter.h"
|
||||
#include "sics.h"
|
||||
|
||||
typedef struct __PENTRY {
|
||||
char *name;
|
||||
@ -152,3 +153,39 @@ int InitPasswd(char *filename)
|
||||
fclose(fp);
|
||||
return iRes;
|
||||
}
|
||||
/*----------------------- Password database update -------------------------*/
|
||||
int PWSicsUser(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
int argc, char *argv[])
|
||||
{
|
||||
char pBueffel[512];
|
||||
TokenList *pList = NULL;
|
||||
|
||||
assert(pSics);
|
||||
assert(pCon);
|
||||
|
||||
/* check authorisation */
|
||||
if (SCGetRights(pCon) > usMugger) {
|
||||
SCWrite(pCon, "Insufficient privilege to set users", eError);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* analyse commandlist */
|
||||
pList = SplitArguments(argc - 1, &argv[1]);
|
||||
if ((!pList) || (!pList->pNext) || (!pList->pNext->pNext)) {
|
||||
snprintf(pBueffel,sizeof(pBueffel)-1, "Invalid Passwd Entry ::\n %s %s %s\n", argv[1],
|
||||
argv[2], argv[3]);
|
||||
SCWrite(pCon, pBueffel, eError);
|
||||
DeleteTokenList(pList);
|
||||
return 0;
|
||||
} else {
|
||||
if (pList->pNext->pNext->Type != eInt) {
|
||||
SCWrite(pCon, "Need integer rights code", eError);
|
||||
DeleteTokenList(pList);
|
||||
return 0;
|
||||
} else {
|
||||
AddUser(pList->text, pList->pNext->text, pList->pNext->pNext->iVal);
|
||||
}
|
||||
}
|
||||
DeleteTokenList(pList);
|
||||
return 1;
|
||||
}
|
||||
|
Reference in New Issue
Block a user