Code Comments
Programming Forum and web based access to our favorite programming groups.Hi, Is it posible for a user _who is not the creator_ of a shared memory segment delete it ? For creating, the user A executes: int iIpckey = 676767; int shm_id = shmget( iIpckey, 100, IPC_CREAT | 0666); I verify that it works with: > ipcs m 2229122 0x000a539f --rw-rw-rw- un4567 sytef ok, and then, the user B tries to delete it with : struct shmid_ds shm_desc; int iIpckey = 676767; int shm_id = shmget( iIpckey, 100, IPC_CREAT | 0666); shmctl(shm_id, IPC_RMID, &shm_desc); but it doesn't work (i think because user B is not the creator). Can someone help me, please ? Thanks in advance. PS : I am working on AIX 5.3 and... sorry for my english :-)
Post Follow-up to this messagejoaquin.hmarquez@gmail.com wrote:
> Hi,
>
> Is it posible for a user _who is not the creator_ of a shared memory
> segment delete it ?
>
> For creating, the user A executes:
>
> int iIpckey = 676767;
> int shm_id = shmget( iIpckey, 100, IPC_CREAT | 0666);
>
> I verify that it works with:
>
> m 2229122 0x000a539f --rw-rw-rw- un4567 sytef
>
> ok, and then, the user B tries to delete it with :
>
> struct shmid_ds shm_desc;
> int iIpckey = 676767;
> int shm_id = shmget( iIpckey, 100, IPC_CREAT | 0666);
#include <errno.h>
if (shm_id == -) {
fprintf(stderr, "error = %d (%s)\n", errno, strerror(errno);
exit (1);
}
> shmctl(shm_id, IPC_RMID, &shm_desc);
>
> but it doesn't work (i think because user B is not the creator).
>
> Can someone help me, please ?
> Thanks in advance.
>
> PS : I am working on AIX 5.3 and... sorry for my english :-)
HTH,
AvK
Post Follow-up to this messageJoaquin, >Is it posible for a user _who is not the creator_ of a shared memory >segment delete it ? To do an IPC_RMID, the calling process must either be privileged, or have an effective UID matching either the owner or the creator UID of the object. (The owner is initially the same as the creator, but this can be changed using shmctl(IPC_SET): struct shmid_ds shmds; shmctl(id, IPC_STAT, &shmds) /* Retrieve copy from kernel */ shmds.shm_perm.uid = newuid; /* Change owner UID field */ shmctl(id, IPC_SET, &shmds) /* Update kernel copy */ ) >PS : I am working on AIX 5.3 The above rule for IPC_RMID is the norm on most Unix systems. > and... sorry for my english :-) It worked fine for me ;-). M
Post Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread
Powered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.