|
@@ -0,0 +1,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 2010-11-22 22:47:25.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
|