better error checking
authorLuke Howard <lukeh@padl.com>
Tue, 12 Oct 2010 01:43:35 +0000 (12:43 +1100)
committerLuke Howard <lukeh@padl.com>
Tue, 12 Oct 2010 01:43:35 +0000 (12:43 +1100)
export_sec_context.c

index 46bf118..54cc3b9 100644 (file)
@@ -42,10 +42,14 @@ gssEapExportPartialContext(OM_uint32 *minor,
     unsigned char *p;
     char serverBuf[MAXHOSTNAMELEN];
 
-    if (ctx->acceptorCtx.radConn != NULL &&
-        rs_conn_get_current_server(ctx->acceptorCtx.radConn,
-                                   serverBuf, sizeof(serverBuf)) == 0)
+    if (ctx->acceptorCtx.radConn != NULL) {
+        if (rs_conn_get_current_server(ctx->acceptorCtx.radConn,
+                                       serverBuf, sizeof(serverBuf)) != 0) {
+            return gssEapRadiusMapError(minor,
+                                        rs_err_conn_pop(ctx->acceptorCtx.radConn));
+        }
         serverLen = strlen(serverBuf);
+    }
 
     length = 4 + serverLen + 4 + ctx->acceptorCtx.state.length;