opencryptoki/opencryptoki-2.4-group.patch
2017-05-17 16:27:12 +05:30

52 lines
1.4 KiB
Diff

diff -upr opencryptoki-3.7.0.orig/usr/lib/pkcs11/api/shrd_mem.c.in opencryptoki-3.7.0/usr/lib/pkcs11/api/shrd_mem.c.in
--- opencryptoki-3.7.0.orig/usr/lib/pkcs11/api/shrd_mem.c.in 2017-05-17 15:13:54.711536688 +0530
+++ opencryptoki-3.7.0/usr/lib/pkcs11/api/shrd_mem.c.in 2017-05-17 15:22:27.758655055 +0530
@@ -56,9 +56,6 @@ attach_shared_memory() {
int shmid;
char *shmp;
struct stat statbuf;
- struct group *grp;
- struct passwd *pw, *epw;
- uid_t uid, euid;
#if !(MMAP)
// Really should fstat the tok_path, since it will be the actual
@@ -70,37 +67,6 @@ attach_shared_memory() {
return NULL;
}
- uid = getuid();
- euid = geteuid();
- // only check group membership if not root user
- if (uid != 0 && euid != 0) {
- int i, member=0;
- grp = getgrnam("pkcs11");
- if (!grp) {
- // group pkcs11 not known to the system
- return NULL;
- }
- pw = getpwuid(uid);
- epw = getpwuid(euid);
- for (i=0; grp->gr_mem[i]; i++) {
- if (pw) {
- if (!strncmp(pw->pw_name, grp->gr_mem[i],strlen(pw->pw_name))) {
- member = 1;
- break;
- }
- }
- if (epw) {
- if (!strncmp(epw->pw_name, grp->gr_mem[i],strlen(epw->pw_name))) {
- member = 1;
- break;
- }
- }
- }
- if (!member) {
- return NULL;
- }
- }
-
Anchor->shm_tok = ftok(TOK_PATH,'b');
// Get the shared memory id.