Print this page
6817447 libgss and various mechs are hiding both the real minor_status and the error token
6405422 Solaris acceptors fail in AD-KDC environments when using non-"host" services (e.g. "cifs")
6824434 Unable to accept context establishment initiated by Windows 2000 clients
6787343 kclient's site lookups fail in certain network environments
6692646 kclient should output errors to stderr
6525327 kinit failed when arcfour-hmac-md5-exp was used for the principal's key
6745582 SUNWkdcu missing package dependencies after kclientv2 integration

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/gss/gssd/gssd_clnt_stubs.c
          +++ new/usr/src/cmd/gss/gssd/gssd_clnt_stubs.c
   1    1  /*
   2    2   * CDDL HEADER START
   3    3   *
   4    4   * The contents of this file are subject to the terms of the
   5      - * Common Development and Distribution License, Version 1.0 only
   6      - * (the "License").  You may not use this file except in compliance
   7      - * with the License.
        5 + * Common Development and Distribution License (the "License").
        6 + * You may not use this file except in compliance with the License.
   8    7   *
   9    8   * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
  10    9   * or http://www.opensolaris.org/os/licensing.
  11   10   * See the License for the specific language governing permissions
  12   11   * and limitations under the License.
  13   12   *
  14   13   * When distributing Covered Code, include this CDDL HEADER in each
  15   14   * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  16   15   * If applicable, add the following below this CDDL HEADER, with the
  17   16   * fields enclosed by brackets "[]" replaced with your own identifying
  18   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  19   18   *
  20   19   * CDDL HEADER END
  21   20   */
       21 +
  22   22  /*
  23      - * Copyright 2003 Sun Microsystems, Inc.  All rights reserved.
       23 + * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  24   24   * Use is subject to license terms.
  25   25   */
  26   26  
  27      -#pragma ident   "%Z%%M% %I%     %E% SMI"
  28      -
  29   27  /*
  30   28   *  GSSAPI library stub module for gssd.
  31   29   */
  32   30  
  33   31  #include <stdio.h>
  34   32  #include <stdlib.h>
  35   33  #include <mechglueP.h>
  36   34  #include "gssd.h"
  37   35  #include <rpc/rpc.h>
  38   36  
↓ open down ↓ 117 lines elided ↑ open up ↑
 156  154  
 157  155          memset(&res, 0, sizeof (res));
 158  156          if (gss_acquire_cred_1(&arg, &res, clnt) != RPC_SUCCESS) {
 159  157  
 160  158          /*
 161  159           * if the RPC call times out, null out all return arguments,
 162  160           * set minor_status to its maximum value, and return GSS_S_FAILURE
 163  161           */
 164  162  
 165  163                  if (minor_status != NULL)
 166      -                        *minor_status = 0xffffffff;
      164 +                        *minor_status = DEFAULT_MINOR_STAT;
 167  165                  if (output_cred_handle != NULL)
 168  166                          *output_cred_handle = NULL;
 169  167                  if (actual_mechs != NULL)
 170  168                          *actual_mechs = NULL;
 171  169                  if (time_rec != NULL)
 172  170                          *time_rec = 0;
 173  171  
 174  172                  return (GSS_S_FAILURE);
 175  173          }
 176  174  
↓ open down ↓ 327 lines elided ↑ open up ↑
 504  502  
 505  503          memset(&res, 0, sizeof (res));
 506  504          if (gss_release_cred_1(&arg, &res, clnt) != RPC_SUCCESS) {
 507  505  
 508  506                  /*
 509  507                   * if the RPC call times out, null out all return arguments,
 510  508                   * set minor_status to its max value, and return GSS_S_FAILURE
 511  509                   */
 512  510  
 513  511                  if (minor_status != NULL)
 514      -                        *minor_status = 0xffffffff;
      512 +                        *minor_status = DEFAULT_MINOR_STAT;
 515  513                  if (cred_handle != NULL)
 516  514                          *cred_handle = NULL;
 517  515  
 518  516                  return (GSS_S_FAILURE);
 519  517          }
 520  518  
 521  519          /* if the release succeeded, null out the cred_handle */
 522  520          if (res.status == GSS_S_COMPLETE && cred_handle != NULL)
 523  521                  *cred_handle = NULL;
 524  522  
↓ open down ↓ 154 lines elided ↑ open up ↑
 679  677                  arg.input_chan_bindings.application_data.GSS_BUFFER_T_val = 0;
 680  678          }
 681  679  
 682  680          arg.input_token.GSS_BUFFER_T_len = (uint_t)
 683  681                  (input_token != GSS_C_NO_BUFFER ? input_token->length : 0);
 684  682          arg.input_token.GSS_BUFFER_T_val = (char *)
 685  683                  (input_token != GSS_C_NO_BUFFER ? input_token->value : 0);
 686  684  
 687  685          /* initialize the output parameters to empty values */
 688  686          if (minor_status != NULL)
 689      -                *minor_status = 0xffffffff;
      687 +                *minor_status = DEFAULT_MINOR_STAT;
 690  688          if (actual_mech_type != NULL)
 691  689                  *actual_mech_type = NULL;
 692  690          if (output_token != NULL)
 693  691                  output_token->length = 0;
 694  692          if (ret_flags != NULL)
 695  693                  *ret_flags = 0;
 696  694          if (time_rec != NULL)
 697  695                  *time_rec = 0;
 698  696  
 699  697          /* call the remote procedure */
 700  698          memset(&res, 0, sizeof (res));
 701  699          if (gss_init_sec_context_1(&arg, &res, clnt) != RPC_SUCCESS) {
 702  700  
 703  701                  /* free the allocated memory for the flattened name */
 704  702                  gss_release_buffer(&minor_status_temp, &external_name);
 705  703  
 706  704                  return (GSS_S_FAILURE);
 707  705          }
 708  706  
      707 +        /*
      708 +         * We could return from a GSS error here and need to return both the
      709 +         * minor_status and output_token, back to the caller if applicable.
      710 +         */
      711 +        if (minor_status != NULL)
      712 +                *minor_status = res.minor_status;
 709  713  
      714 +        if (output_token != NULL && res.output_token.GSS_BUFFER_T_val != NULL) {
      715 +                output_token->length =
      716 +                        (size_t)res.output_token.GSS_BUFFER_T_len;
      717 +                output_token->value =
      718 +                        (void *)res.output_token.GSS_BUFFER_T_val;
      719 +                res.output_token.GSS_BUFFER_T_val = NULL;
      720 +                res.output_token.GSS_BUFFER_T_len = 0;
      721 +        }
      722 +
 710  723          /* free the allocated memory for the flattened name */
 711  724          gss_release_buffer(&minor_status_temp, &external_name);
 712  725  
 713  726          /* if the call was successful, copy out the results */
 714  727          if (res.status == (OM_uint32) GSS_S_COMPLETE ||
 715  728                  res.status == (OM_uint32) GSS_S_CONTINUE_NEEDED) {
 716  729                  /*
 717      -                 * copy the rpc results into the return arguments
 718      -                 * on CONTINUE_NEEDED only the output token, minor
 719      -                 * code and ctxt handle are ready.
      730 +                 * copy the rpc results into the return argument
      731 +                 * on CONTINUE_NEEDED only ctx handle is ready.
 720  732                   */
 721      -                if (minor_status != NULL)
 722      -                        *minor_status = res.minor_status;
 723  733                  /*LINTED*/
 724  734                  *context_handle = *((OM_uint32 *)
 725  735                          res.context_handle.GSS_CTX_ID_T_val);
 726      -
 727      -                /*LINTED*/
 728      -                *context_handle = *((OM_uint32 *)
 729      -                        res.context_handle.GSS_CTX_ID_T_val);
 730  736                  *gssd_context_verifier = res.gssd_context_verifier;
 731  737  
 732      -                if (output_token != NULL) {
 733      -                        output_token->length =
 734      -                                (size_t)res.output_token.GSS_BUFFER_T_len;
 735      -                        output_token->value =
 736      -                                (void *)res.output_token.GSS_BUFFER_T_val;
 737      -                        res.output_token.GSS_BUFFER_T_val = NULL;
 738      -                        res.output_token.GSS_BUFFER_T_len = 0;
 739      -                }
 740  738  
 741  739                  /* the rest of the parameters is only ready on COMPLETE */
 742  740                  if (res.status == GSS_S_COMPLETE) {
 743  741                          if (actual_mech_type != NULL) {
 744  742                                  *actual_mech_type = (gss_OID)
 745  743                                          MALLOC(sizeof (gss_OID_desc));
 746  744                                  (*actual_mech_type)->length = (OM_UINT32)
 747  745                                          res.actual_mech_type.GSS_OID_len;
 748  746                                  (*actual_mech_type)->elements = (void *)
 749  747                                          MALLOC((*actual_mech_type)->length);
↓ open down ↓ 168 lines elided ↑ open up ↑
 918  916                  arg.input_chan_bindings.initiator_address.GSS_BUFFER_T_val = 0;
 919  917                  arg.input_chan_bindings.acceptor_addrtype = 0;
 920  918                  arg.input_chan_bindings.acceptor_address.GSS_BUFFER_T_len = 0;
 921  919                  arg.input_chan_bindings.acceptor_address.GSS_BUFFER_T_val = 0;
 922  920                  arg.input_chan_bindings.application_data.GSS_BUFFER_T_len = 0;
 923  921                  arg.input_chan_bindings.application_data.GSS_BUFFER_T_val = 0;
 924  922          }
 925  923  
 926  924          /* set the output parameters to empty values.... */
 927  925          if (minor_status != NULL)
 928      -                *minor_status = 0xffffffff;
      926 +                *minor_status = DEFAULT_MINOR_STAT;
 929  927          if (src_name != NULL) {
 930  928                  src_name->length = 0;
 931  929                  src_name->value = NULL;
 932  930          }
 933  931          if (mech_type != NULL)
 934  932                  *mech_type = NULL;
 935  933          if (output_token != NULL)
 936  934                  output_token->length = 0;
 937  935          if (ret_flags != NULL)
 938  936                  *ret_flags = 0;
↓ open down ↓ 1 lines elided ↑ open up ↑
 940  938                  *time_rec = 0;
 941  939          if (delegated_cred_handle != NULL)
 942  940                  *delegated_cred_handle = NULL;
 943  941  
 944  942          /* call the remote procedure */
 945  943          memset(&res, 0, sizeof (res));
 946  944          if (gss_accept_sec_context_1(&arg, &res, clnt) != RPC_SUCCESS) {
 947  945                  return (GSS_S_FAILURE);
 948  946          }
 949  947  
      948 +        /*
      949 +         * We could return from a GSS error here and need to return both the
      950 +         * minor_status and output_token, back to the caller if applicable.
      951 +         */
      952 +        if (minor_status != NULL)
      953 +                *minor_status = res.minor_status;
 950  954  
      955 +        if (output_token != NULL && res.output_token.GSS_BUFFER_T_val != NULL) {
      956 +                output_token->length =
      957 +                        res.output_token.GSS_BUFFER_T_len;
      958 +                output_token->value =
      959 +                        (void *) res.output_token.GSS_BUFFER_T_val;
      960 +                res.output_token.GSS_BUFFER_T_val = 0;
      961 +                res.output_token.GSS_BUFFER_T_len = 0;
      962 +        }
      963 +
 951  964          if (res.status == (OM_uint32) GSS_S_COMPLETE ||
 952  965                  res.status == (OM_uint32) GSS_S_CONTINUE_NEEDED) {
 953  966                  /*
 954  967                   * when gss returns CONTINUE_NEEDED we can only
 955      -                 * use the context, minor, and output token
 956      -                 * parameters.
      968 +                 * use the context parameter.
 957  969                   */
 958  970                  /*LINTED*/
 959  971                  *context_handle = *((gssd_ctx_id_t *)
 960  972                          res.context_handle.GSS_CTX_ID_T_val);
 961  973                  *gssd_context_verifier = res.gssd_context_verifier;
 962  974  
 963      -                if (output_token != NULL) {
 964      -                        output_token->length =
 965      -                                res.output_token.GSS_BUFFER_T_len;
 966      -                        output_token->value =
 967      -                                (void *) res.output_token.GSS_BUFFER_T_val;
 968      -                        res.output_token.GSS_BUFFER_T_val = 0;
 969      -                        res.output_token.GSS_BUFFER_T_len = 0;
 970      -                }
 971      -
 972      -                if (minor_status != NULL)
 973      -                        *minor_status = res.minor_status;
 974      -
 975  975                  /* the other parameters are ready on for COMPLETE */
 976  976                  if (res.status == GSS_S_COMPLETE)
 977  977                  {
 978      -
 979  978                          /*
 980  979                           *  The src_name is in external format.
 981  980                           */
 982  981                          if (src_name != NULL) {
 983  982                              src_name->length = res.src_name.GSS_BUFFER_T_len;
 984  983                              src_name->value = res.src_name.GSS_BUFFER_T_val;
 985  984                              res.src_name.GSS_BUFFER_T_val = NULL;
 986  985                              res.src_name.GSS_BUFFER_T_len = 0;
 987  986                          }
 988  987                          /*
↓ open down ↓ 131 lines elided ↑ open up ↑
1120 1119  
1121 1120          memset(&res, 0, sizeof (res));
1122 1121          if (gss_process_context_token_1(&arg, &res, clnt) != RPC_SUCCESS) {
1123 1122  
1124 1123          /*
1125 1124           * if the RPC call times out, null out all return arguments,
1126 1125           * set minor_status to its maximum value, and return GSS_S_FAILURE
1127 1126           */
1128 1127  
1129 1128                  if (minor_status != NULL)
1130      -                        *minor_status = 0xffffffff;
     1129 +                        *minor_status = DEFAULT_MINOR_STAT;
1131 1130  
1132 1131                  return (GSS_S_FAILURE);
1133 1132          }
1134 1133  
1135 1134          /* copy the rpc results into the return arguments */
1136 1135  
1137 1136          if (minor_status != NULL)
1138 1137                  *minor_status = res.minor_status;
1139 1138  
1140 1139          /* return with status returned in rpc call */
↓ open down ↓ 34 lines elided ↑ open up ↑
1175 1174  
1176 1175          memset(&res, 0, sizeof (res));
1177 1176          if (gss_delete_sec_context_1(&arg, &res, clnt) != RPC_SUCCESS) {
1178 1177  
1179 1178                  /*
1180 1179                   * if the RPC call times out, null out all return arguments,
1181 1180                   * set minor_status to its max value, and return GSS_S_FAILURE
1182 1181                   */
1183 1182  
1184 1183                  if (minor_status != NULL)
1185      -                        *minor_status = 0xffffffff;
     1184 +                        *minor_status = DEFAULT_MINOR_STAT;
1186 1185                  if (context_handle != NULL)
1187 1186                          *context_handle = NULL;
1188 1187                  if (output_token != NULL)
1189 1188                          output_token->length = 0;
1190 1189  
1191 1190                  return (GSS_S_FAILURE);
1192 1191          }
1193 1192  
1194 1193          /* copy the rpc results into the return arguments */
1195 1194  
1196 1195          if (minor_status != NULL)
1197 1196                  *minor_status = res.minor_status;
1198 1197  
1199 1198          if (res.context_handle.GSS_CTX_ID_T_len == 0)
1200 1199                  *context_handle = NULL;
1201 1200          else
1202 1201                  /*LINTED*/
1203 1202                  *context_handle = *((gssd_ctx_id_t *)
1204 1203                          res.context_handle.GSS_CTX_ID_T_val);
1205 1204  
1206      -        if (output_token != NULL) {
     1205 +        if (output_token != NULL && res.output_token.GSS_BUFFER_T_val != NULL) {
1207 1206                  output_token->length = res.output_token.GSS_BUFFER_T_len;
1208 1207                  output_token->value = res.output_token.GSS_BUFFER_T_val;
1209 1208                  res.output_token.GSS_BUFFER_T_len = 0;
1210 1209                  res.output_token.GSS_BUFFER_T_val = NULL;
1211 1210          }
1212 1211  
1213 1212          /*
1214 1213           * free the memory allocated for the results and return with the status
1215 1214           * received in the rpc call
1216 1215           */
↓ open down ↓ 85 lines elided ↑ open up ↑
1302 1301  
1303 1302          memset(&res, 0, sizeof (res));
1304 1303          if (gss_sign_1(&arg, &res, clnt) != RPC_SUCCESS) {
1305 1304  
1306 1305          /*
1307 1306           * if the RPC call times out, null out all return arguments,
1308 1307           * set minor_status to its maximum value, and return GSS_S_FAILURE
1309 1308           */
1310 1309  
1311 1310                  if (minor_status != NULL)
1312      -                        *minor_status = 0xffffffff;
     1311 +                        *minor_status = DEFAULT_MINOR_STAT;
1313 1312                  if (msg_token != NULL)
1314 1313                          msg_token->length = 0;
1315 1314  
1316 1315                  return (GSS_S_FAILURE);
1317 1316          }
1318 1317  
1319 1318          /* copy the rpc results into the return arguments */
1320 1319  
1321 1320          if (minor_status != NULL)
1322 1321                  *minor_status = res.minor_status;
↓ open down ↓ 72 lines elided ↑ open up ↑
1395 1394  
1396 1395          memset(&res, 0, sizeof (res));
1397 1396          if (gss_verify_1(&arg, &res, clnt) != RPC_SUCCESS) {
1398 1397  
1399 1398          /*
1400 1399           * if the RPC call times out, null out all return arguments,
1401 1400           * set minor_status to its maximum value, and return GSS_S_FAILURE
1402 1401           */
1403 1402  
1404 1403                  if (minor_status != NULL)
1405      -                        *minor_status = 0xffffffff;
     1404 +                        *minor_status = DEFAULT_MINOR_STAT;
1406 1405                  if (qop_state != NULL)
1407 1406                          *qop_state = 0;
1408 1407  
1409 1408                  return (GSS_S_FAILURE);
1410 1409          }
1411 1410  
1412 1411          /* copy the rpc results into the return arguments */
1413 1412  
1414 1413          if (minor_status != NULL)
1415 1414                  *minor_status = res.minor_status;
↓ open down ↓ 75 lines elided ↑ open up ↑
1491 1490  
1492 1491          memset(&res, 0, sizeof (res));
1493 1492          if (gss_seal_1(&arg, &res, clnt) != RPC_SUCCESS) {
1494 1493  
1495 1494          /*
1496 1495           * if the RPC call times out, null out all return arguments,
1497 1496           * set minor_status to its maximum value, and return GSS_S_FAILURE
1498 1497           */
1499 1498  
1500 1499                  if (minor_status != NULL)
1501      -                        *minor_status = 0xffffffff;
     1500 +                        *minor_status = DEFAULT_MINOR_STAT;
1502 1501                  if (conf_state != NULL)
1503 1502                          *conf_state = 0;
1504 1503                  if (output_message_buffer != NULL)
1505 1504                          output_message_buffer->length = 0;
1506 1505  
1507 1506                  return (GSS_S_FAILURE);
1508 1507          }
1509 1508  
1510 1509          /* copy the rpc results into the return arguments */
1511 1510  
↓ open down ↓ 85 lines elided ↑ open up ↑
1597 1596  
1598 1597          memset(&res, 0, sizeof (res));
1599 1598          if (gss_unseal_1(&arg, &res, clnt) != RPC_SUCCESS) {
1600 1599  
1601 1600          /*
1602 1601           * if the RPC call times out, null out all return arguments,
1603 1602           * set minor_status to its maximum value, and return GSS_S_FAILURE
1604 1603           */
1605 1604  
1606 1605                  if (minor_status != NULL)
1607      -                        *minor_status = 0xffffffff;
     1606 +                        *minor_status = DEFAULT_MINOR_STAT;
1608 1607                  if (output_message_buffer != NULL)
1609 1608                          output_message_buffer->length = 0;
1610 1609                  if (conf_state != NULL)
1611 1610                          *conf_state = 0;
1612 1611                  if (qop_state != NULL)
1613 1612                          *qop_state = 0;
1614 1613  
1615 1614                  return (GSS_S_FAILURE);
1616 1615          }
1617 1616  
↓ open down ↓ 98 lines elided ↑ open up ↑
1716 1715  
1717 1716          memset(&res, 0, sizeof (res));
1718 1717          if (gss_display_status_1(&arg, &res, clnt) != RPC_SUCCESS) {
1719 1718  
1720 1719          /*
1721 1720           * if the RPC call times out, null out all return arguments,
1722 1721           * set minor_status to its maximum value, and return GSS_S_FAILURE
1723 1722           */
1724 1723  
1725 1724                  if (minor_status != NULL)
1726      -                        *minor_status = 0xffffffff;
     1725 +                        *minor_status = DEFAULT_MINOR_STAT;
1727 1726  
1728 1727                  return (GSS_S_FAILURE);
1729 1728          }
1730 1729  
     1730 +        if (minor_status != NULL)
     1731 +                *minor_status = res.minor_status;
1731 1732  
1732 1733          /* now process the results and pass them back to the caller */
1733 1734  
1734 1735          if (res.status == GSS_S_COMPLETE) {
1735      -                if (minor_status != NULL)
1736      -                        *minor_status = res.minor_status;
1737 1736                  if (message_context != NULL)
1738 1737                          *message_context = res.message_context;
1739 1738                  if (status_string != NULL) {
1740 1739                          status_string->length =
1741 1740                                  (size_t)res.status_string.GSS_BUFFER_T_len;
1742 1741                          status_string->value =
1743 1742                                  (void *)MALLOC(status_string->length);
1744 1743                          memcpy(status_string->value,
1745 1744                                  res.status_string.GSS_BUFFER_T_val,
1746 1745                                  status_string->length);
↓ open down ↓ 26 lines elided ↑ open up ↑
1773 1772  
1774 1773          memset(&res, 0, sizeof (res));
1775 1774          if (gss_indicate_mechs_1(&arg, &res, clnt) != RPC_SUCCESS) {
1776 1775  
1777 1776          /*
1778 1777           * if the RPC call times out, null out all return arguments,
1779 1778           * set minor_status to its maximum value, and return GSS_S_FAILURE
1780 1779           */
1781 1780  
1782 1781                  if (minor_status != NULL)
1783      -                        *minor_status = 0xffffffff;
     1782 +                        *minor_status = DEFAULT_MINOR_STAT;
1784 1783                  if (mech_set != NULL)
1785 1784                          *mech_set = NULL;
1786 1785  
1787 1786                  return (GSS_S_FAILURE);
1788 1787          }
1789 1788  
1790 1789          /* copy the rpc results into the return arguments */
1791 1790  
1792 1791          if (minor_status != NULL)
1793 1792                  *minor_status = res.minor_status;
↓ open down ↓ 72 lines elided ↑ open up ↑
1866 1865  
1867 1866          memset(&res, 0, sizeof (res));
1868 1867          if (gss_inquire_cred_1(&arg, &res, clnt) != RPC_SUCCESS) {
1869 1868  
1870 1869          /*
1871 1870           * if the RPC call times out, null out all return arguments,
1872 1871           * set minor_status to its maximum value, and return GSS_S_FAILURE
1873 1872           */
1874 1873  
1875 1874                  if (minor_status != NULL)
1876      -                        *minor_status = 0xffffffff;
     1875 +                        *minor_status = DEFAULT_MINOR_STAT;
1877 1876                  if (name != NULL)
1878 1877                          *name = NULL;
1879 1878                  if (lifetime != NULL)
1880 1879                          *lifetime = 0;
1881 1880                  if (cred_usage != NULL)
1882 1881                          *cred_usage = 0;
1883 1882                  if (mechanisms != NULL)
1884 1883                          *mechanisms = NULL;
1885 1884  
1886 1885                  return (GSS_S_FAILURE);
↓ open down ↓ 148 lines elided ↑ open up ↑
2035 2034  
2036 2035          memset(&res, 0, sizeof (res));
2037 2036          if (gss_inquire_cred_by_mech_1(&arg, &res, clnt) != RPC_SUCCESS) {
2038 2037  
2039 2038          /*
2040 2039           * if the RPC call times out, null out all return arguments,
2041 2040           * set minor_status to its maximum value, and return GSS_S_FAILURE
2042 2041           */
2043 2042  
2044 2043                  if (minor_status != NULL)
2045      -                        *minor_status = 0xffffffff;
     2044 +                        *minor_status = DEFAULT_MINOR_STAT;
2046 2045                  return (GSS_S_FAILURE);
2047 2046          }
2048 2047  
2049 2048          /* copy the rpc results into the return arguments */
2050 2049  
2051 2050          if (minor_status != NULL)
2052 2051                  *minor_status = res.minor_status;
2053 2052  
2054 2053          /* convert name from external to internal format */
2055 2054  
↓ open down ↓ 285 lines elided ↑ open up ↑
2341 2340  
2342 2341          if (minor_status != NULL)
2343 2342                  *minor_status = res.minor_status;
2344 2343  
2345 2344          if (res.context_handle.GSS_CTX_ID_T_len == 0)
2346 2345                  *context_handle = NULL;
2347 2346          else
2348 2347                  *context_handle =
2349 2348                      *((gssd_ctx_id_t *)res.context_handle.GSS_CTX_ID_T_val);
2350 2349  
2351      -        if (output_token != NULL) {
     2350 +        if (output_token != NULL && res.output_token.GSS_BUFFER_T_val != NULL) {
2352 2351                  output_token->length = res.output_token.GSS_BUFFER_T_len;
2353 2352                  output_token->value =
2354 2353                          (void *) MALLOC(output_token->length);
2355 2354                  memcpy(output_token->value,
2356 2355                          res.output_token.GSS_BUFFER_T_val,
2357 2356                          output_token->length);
2358 2357          }
2359 2358  
2360 2359  /*
2361 2360   * free the memory allocated for the results and return with the status
↓ open down ↓ 324 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX