clean up ftp client gss memory management
authorTom Yu <tlyu@mit.edu>
Wed, 25 Jun 2003 21:10:48 +0000 (21:10 +0000)
committerTom Yu <tlyu@mit.edu>
Wed, 25 Jun 2003 21:10:48 +0000 (21:10 +0000)
* ftp.c (do_auth): Call gss_release_buffer() on send_tok
immediately after sending it.  Call gss_release_name() on
target_name at outer_loop instead of inside the loop.

ticket: new

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@15651 dc483132-0cff-0310-8789-dd5450dbe970

src/appl/gssftp/ftp/ChangeLog
src/appl/gssftp/ftp/ftp.c

index 445734fb2640afd00cc1830b1d747de69a640410..600eb2688254359fc277dae7ac5f42c797b6d1ca 100644 (file)
@@ -1,3 +1,9 @@
+2003-06-25  Tom Yu  <tlyu@mit.edu>
+
+       * ftp.c (do_auth): Call gss_release_buffer() on send_tok
+       immediately after sending it.  Call gss_release_name() on
+       target_name at outer_loop instead of inside the loop.
+
 2003-06-16  Ken Raeburn  <raeburn@mit.edu>
 
        * ftp.c (recvrequest): Add new argument indicating whether "-" and
index 155f857925d0857c9c6adc7538029eb3a9fa4a58..769a3cd177f313d6208d7a2121bd0b3b33d2db67 100644 (file)
@@ -1983,7 +1983,7 @@ int do_auth()
 
 #ifdef GSSAPI
        if (command("AUTH %s", "GSSAPI") == CONTINUE) {
-         OM_uint32 maj_stat, min_stat;
+         OM_uint32 maj_stat, min_stat, dummy_stat;
          gss_name_t target_name;
          gss_buffer_desc send_tok, recv_tok, *token_ptr;
          char stbuf[FTP_BUFSIZ];
@@ -2048,7 +2048,6 @@ int do_auth()
              if (maj_stat!=GSS_S_COMPLETE && maj_stat!=GSS_S_CONTINUE_NEEDED){
                if (trial == n_gss_trials-1)
                  user_gss_error(maj_stat, min_stat, "initializing context");
-               (void) gss_release_name(&min_stat, &target_name);
                /* could just be that we missed on the service name */
                goto outer_loop;
              }
@@ -2059,6 +2058,7 @@ int do_auth()
                oldverbose = verbose;
                verbose = (trial == n_gss_trials-1)?0:-1;
                kerror = radix_encode(send_tok.value, out_buf, &len, 0);
+               gss_release_buffer(&dummy_stat, &send_tok);
                if (kerror)  {
                  fprintf(stderr, "Base 64 encoding failed: %s\n",
                          radix_error(kerror));
@@ -2104,12 +2104,11 @@ int do_auth()
                /* get out of loop clean */
              gss_complete_loop:
                trial = n_gss_trials-1;
-               gss_release_buffer(&min_stat, &send_tok);
-               gss_release_name(&min_stat, &target_name);
                goto outer_loop;
              }
            } while (maj_stat == GSS_S_CONTINUE_NEEDED);
     outer_loop:
+           gss_release_name(&dummy_stat, &target_name);
            if (maj_stat == GSS_S_COMPLETE)
                break;
          }