summaryrefslogtreecommitdiff
path: root/package/open-iscsi/patches/patch-usr_mgmt_ipc_c
blob: d1d936e0fd3c0077557f0c9b34990bcaf991d837 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
--- open-iscsi-2.0-871.orig/usr/mgmt_ipc.c	2009-07-11 05:55:58.000000000 +0200
+++ open-iscsi-2.0-871/usr/mgmt_ipc.c	2014-01-03 12:35:32.000000000 +0100
@@ -341,31 +341,7 @@ mgmt_ipc_notify_del_portal(queue_task_t
 static int
 mgmt_peeruser(int sock, char *user)
 {
-#if defined(SO_PEERCRED)
-	/* Linux style: use getsockopt(SO_PEERCRED) */
-	struct ucred peercred;
-	socklen_t so_len = sizeof(peercred);
-	struct passwd *pass;
-
-	errno = 0;
-	if (getsockopt(sock, SOL_SOCKET, SO_PEERCRED, &peercred,
-		&so_len) != 0 || so_len != sizeof(peercred)) {
-		/* We didn't get a valid credentials struct. */
-		log_error("peeruser_unux: error receiving credentials: %m");
-		return 0;
-	}
-
-	pass = getpwuid(peercred.uid);
-	if (pass == NULL) {
-		log_error("peeruser_unix: unknown local user with uid %d",
-				(int) peercred.uid);
-		return 0;
-	}
-
-	strlcpy(user, pass->pw_name, PEERUSER_MAX);
-	return 1;
-
-#elif defined(SCM_CREDS)
+#if defined(SCM_CREDS)
 	struct msghdr msg;
 	typedef struct cmsgcred Cred;
 #define cruid cmcred_uid