Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <pwd.h>
- #include <grp.h>
- #include <stdlib.h>
- #include <stdio.h>
- #include <sys/types.h>
- #include <unistd.h>
- #include <dlfcn.h>
- int main(void){
- void *uchwyt;
- char *name;
- uid_t user = getuid();
- gid_t groupid = getgid();
- struct passwd *userpass = getpwuid(user);
- //struct group *l = getgrnam("lukasz");
- //if (l->gr_mem[0]==NULL) printf("Dziwne\n");
- setgrent();
- struct group *aktualna;
- printf("ID uzytkownika: %d\n", userpass->pw_uid);
- printf("Uzytkownik: %s\n", userpass->pw_name);
- name = userpass->pw_name;
- uchwyt = dlopen("fun.so",RTLD_LAZY);
- if(!uchwyt) {
- fprintf(stderr, "%s\n", dlerror());
- exit(1);
- }
- return(0);
- }
- #include <pwd.h>
- #include <grp.h>
- #include <stdlib.h>
- #include <stdio.h>
- #include <sys/types.h>
- #include <unistd.h>
- void jakieGrupy(int *name){
- printf("Nalezy do grup: \n");
- while ( (aktualna=getgrent()) != NULL){
- //printf("Grupa: %s\n",aktualna->gr_name);
- int w = 0;
- int g = 0;
- while (aktualna->gr_mem[w] != NULL){
- //printf("\tMember: %s\n",aktualna->gr_mem[w]);
- if (strcmp(name,aktualna->gr_mem[w])==0){
- printf("%s\n",aktualna->gr_name);
- }
- w++;
- }
- }
- endgrent();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement