This is a discussion on ACCESSING ROLE INFORMATION FROM ROLE databse. - Aix ; Hi all, i have to access role information through c. The details of the APIS can be found in the following link: http://publib.boulder.ibm.com/infoce...etroleattr.htm I have written a sample code which looks like the following: # include # include void main() ...
Hi all,
i have to access role information through c.
The details of the APIS can be found in the following link:
http://publib.boulder.ibm.com/infoce...etroleattr.htm
I have written a sample code which looks like the following:
# include
# include
void main()
{
char *rolename;
int count = 0 ;
// Open Roles Database
int a = (setroledb (S_READ);
printf("\nresult of setroledb = %d\n",a);
if (a ==-1)
{
// Unable to open Role database
printf("DATABASE CONNECTION NOT ESTABLISHED\n");
}
else // Iterate over all Roles in the database
while (rolename=nextrole())
{
count ++;
printf("%d %s\n",count,rolename);
free (rolename);
}
printf("\nNo. of roles present = %d\n",count);
// Close Roles Database
endroledb();
}
this code fetches a partial list of roles .
if i comment free (rolename) i get the complete list.
I have seen free being used in the same situation.
hence i want to ask is it a good idea to use free() here. If not why.
Please respond to this query ASAP.
Thanks in advance: