patch-usr_mgmt_ipc_c 1.0 KB

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