Solved

transmit group set to a child under SUN Solaris

Posted on 2002-03-13
4
320 Views
Last Modified: 2013-12-26
SUN Solaris 'exec' system call reset the current group set.

Does anybody know aworkaround for this?

the following chunk of code well explain the problem: the child process does not inherit the additional group. Under Linux and AIX it does, that is the code below works fine.

  if ((ngroups=getgroups(NGROUPS_MAX,array_of_gids))==-1){
    if (!silent)
      perror("ERROR! getgroups");
    return 10;
  }

  /* Add a group to array of groups */
  array_of_gids[ngroups++]= <any group number you like>;
  if (setgroups(ngroups,array_of_gids)==-1){
    if (!silent)
      perror("ERROR! setgroups");
    return 2;
  }

  system("groups");



thank you all
0
Comment
Question by:mliberi
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 5

Expert Comment

by:ecw
ID: 6868224
err, are you running as non-root with silent != 0
0
 
LVL 3

Author Comment

by:mliberi
ID: 6876557
the chunk of code I submitted runs with effective user id ==0

silent is a flag used to optionally disable printing error messages to stderr. You can assume it to be FALSE.

The program executes the last command 'system("groups")', but the group previously added doesn't appear in the output generated by 'groups' command.
0
 
LVL 5

Accepted Solution

by:
ecw earned 100 total points
ID: 6877036
Yep, I've checked it, and the man page for groups(1).  If you replace system("groups") with system("id -a") you might find it is in fact working.  groups(1) gets its info from /etc/passwd and /etc/group, not the current process context.
0
 
LVL 3

Author Comment

by:mliberi
ID: 6890056
Oooooops

I'm glad to discover that my problem was so simple to solve.
thank you
0

Featured Post

What Is Transaction Monitoring and who needs it?

Synthetic Transaction Monitoring that you need for the day to day, which ensures your business website keeps running optimally, and that there is no downtime to impact your customer experience.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question