opencryptoki/opencryptoki-2.4-group.patch

52 lines
1.3 KiB
Diff

diff -up opencryptoki/usr/lib/pkcs11/api/shrd_mem.c.in.group opencryptoki/usr/lib/pkcs11/api/shrd_mem.c.in
--- opencryptoki/usr/lib/pkcs11/api/shrd_mem.c.in.group 2015-08-27 11:35:42.759397175 +0200
+++ opencryptoki/usr/lib/pkcs11/api/shrd_mem.c.in 2015-08-27 11:39:02.240023425 +0200
@@ -338,9 +338,6 @@
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
@@ -352,37 +352,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.