#257 Fix handling of selinux context when NULL
Merged 4 years ago by rharwood. Opened 4 years ago by simo.
simo/gssproxy selictx  into  master

file modified
+5 -2
@@ -122,7 +122,9 @@ 

          close(conn->us.sd);

      }

      free(conn->program);

-     SELINUX_context_free(conn->selinux_ctx);

+     if (conn->selinux_ctx) {

+         SELINUX_context_free(conn->selinux_ctx);

+     }

      free(conn);

  }

  
@@ -635,7 +637,8 @@ 

                  conn->creds.ucred.uid,

                  conn->creds.ucred.gid);

      }

-     if (conn->creds.type & CRED_TYPE_SELINUX) {

+     if ((conn->creds.type & CRED_TYPE_SELINUX) &&

+         (conn->selinux_ctx != NULL)) {

          GPDEBUG(" (context = %s)",

                  SELINUX_context_str(conn->selinux_ctx));

      }

@simo, thank you! Looks good to me, but let me verify.

brilliant!
There is no more crash.

Worth noting that recent versions of libselinux do seem to correctly handle NULL here. However, since there are apparently versions that don't, we should still fix.

Commit 3b77666 fixes this pull-request

Pull-Request has been merged by rharwood

4 years ago