Groupe global d'un domaine NT4

cs_jubei Messages postés 1 Date d'inscription mardi 11 mars 2003 Statut Membre Dernière intervention 24 septembre 2003 - 24 sept. 2003 à 09:56
BruNews Messages postés 21040 Date d'inscription jeudi 23 janvier 2003 Statut Modérateur Dernière intervention 21 août 2019 - 24 sept. 2003 à 10:12
Salut

Je cherche le moyen de récupéré tout les groupes globaux et leurs utilisateurs d'un serveur de domaine NT4 (et non active directory!!!!!)

Quelqu'un a t-il déjà fais ça ?
Si on peut me guider c'est sympa

merci @++++

***Jubei*** ;)

2 réponses

cs_Kaid Messages postés 949 Date d'inscription mardi 2 octobre 2001 Statut Membre Dernière intervention 8 juillet 2006 1
24 sept. 2003 à 10:10
Regarde du côté des fonctions suivantes de gestion réseau de l'API Win32:

NetUserEnum();
NetGroupEnum();


Kaid - kaid.fr.st
0
BruNews Messages postés 21040 Date d'inscription jeudi 23 janvier 2003 Statut Modérateur Dernière intervention 21 août 2019
24 sept. 2003 à 10:12
Partant de cela tu devrais pouvoir te debrouiller, note que je charge pointeurs de fonctions en dynamique pour qu'il n'y ait pas de probleme sur les WinBebes.

DWORD IsCurrentUserAdmin()
{
HANDLE htoken;
BYTE infos[1024];
PTOKEN_GROUPS pgroups = (PTOKEN_GROUPS)infos;
DWORD dwlen;
PSID psidAdmins;
SID_IDENTIFIER_AUTHORITY siaNtAuthority = SECURITY_NT_AUTHORITY;
BOOL b = 0;
pOPENPROCESSTOKEN pOPTK;
pGETTOKENINFORMATION pGTINF;
pALLOCINITSID pALLIS;
pEQUALSID pEQSID;
pFREESID pFRSD;
HINSTANCE hdll = LoadLibrary("Advapi32.dll");
if(!hdll) return 0;
pOPTK = (pOPENPROCESSTOKEN) GetProcAddress(hdll, "OpenProcessToken");
if(!pOPTK) goto relDll;
pGTINF = (pGETTOKENINFORMATION) GetProcAddress(hdll, "GetTokenInformation");
if(!pGTINF) goto relDll;
if(!pOPTK(GetCurrentProcess(),TOKEN_READ,&htoken)) goto relDll;
b = pGTINF(htoken,TokenGroups,infos, 1024, &dwlen);
CloseHandle(htoken);
if(b) goto relDll;
pALLIS = (pALLOCINITSID) GetProcAddress(hdll, "AllocateAndInitializeSid");
if(!pALLIS) goto relDll;
pEQSID = (pEQUALSID) GetProcAddress(hdll, "EqualSid");
if(!pEQSID) goto relDll;
pFRSD = (pFREESID) GetProcAddress(hdll, "FreeSid");
if(!pFRSD) goto relDll;
if(!pALLIS(&siaNtAuthority, 2, SECURITY_BUILTIN_DOMAIN_RID,
DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, 0, 0, &psidAdmins)) goto relDll;
for(UINT x=0; x < pgroups->GroupCount; x++) {
if(pEQSID(psidAdmins, pgroups->Groups[x].Sid)) {b = 1; break;}
}
pFRSD(&psidAdmins);
relDll: FreeLibrary(hdll);
return b;
}

BruNews, ciao...
0
Rejoignez-nous