diff options
-rw-r--r-- | lib/krb4.c | 24 | ||||
-rw-r--r-- | lib/krb4.h | 5 | ||||
-rw-r--r-- | lib/security.c | 12 |
3 files changed, 18 insertions, 23 deletions
diff --git a/lib/krb4.c b/lib/krb4.c index 2b59fec8e..f5199312d 100644 --- a/lib/krb4.c +++ b/lib/krb4.c @@ -7,7 +7,7 @@ * * Copyright (c) 1995, 1996, 1997, 1998, 1999 Kungliga Tekniska Högskolan * (Royal Institute of Technology, Stockholm, Sweden). - * Copyright (c) 2004 - 2009 Daniel Stenberg + * Copyright (c) 2004 - 2010 Daniel Stenberg * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -315,6 +315,14 @@ struct Curl_sec_client_mech Curl_krb4_client_mech = { krb4_decode }; +static enum protection_level +krb4_set_command_prot(struct connectdata *conn, enum protection_level level) +{ + enum protection_level old = conn->command_prot; + conn->command_prot = level; + return old; +} + CURLcode Curl_krb_kauth(struct connectdata *conn) { des_cblock key; @@ -329,7 +337,7 @@ CURLcode Curl_krb_kauth(struct connectdata *conn) CURLcode result; unsigned char *ptr; - save = Curl_set_command_prot(conn, prot_private); + save = krb4_set_command_prot(conn, prot_private); result = Curl_ftpsendf(conn, "SITE KAUTH %s", conn->user); @@ -341,14 +349,14 @@ CURLcode Curl_krb_kauth(struct connectdata *conn) return result; if(conn->data->state.buffer[0] != '3'){ - Curl_set_command_prot(conn, save); + krb4_set_command_prot(conn, save); return CURLE_FTP_WEIRD_SERVER_REPLY; } p = strstr(conn->data->state.buffer, "T="); if(!p) { Curl_failf(conn->data, "Bad reply from server"); - Curl_set_command_prot(conn, save); + krb4_set_command_prot(conn, save); return CURLE_FTP_WEIRD_SERVER_REPLY; } @@ -360,7 +368,7 @@ CURLcode Curl_krb_kauth(struct connectdata *conn) } if(!tmp || !ptr) { Curl_failf(conn->data, "Failed to decode base64 in reply"); - Curl_set_command_prot(conn, save); + krb4_set_command_prot(conn, save); return CURLE_FTP_WEIRD_SERVER_REPLY; } memcpy((char *)tkt.dat, ptr, tmp); @@ -371,7 +379,7 @@ CURLcode Curl_krb_kauth(struct connectdata *conn) p = strstr(conn->data->state.buffer, "P="); if(!p) { Curl_failf(conn->data, "Bad reply from server"); - Curl_set_command_prot(conn, save); + krb4_set_command_prot(conn, save); return CURLE_FTP_WEIRD_SERVER_REPLY; } name = p + 2; @@ -400,7 +408,7 @@ CURLcode Curl_krb_kauth(struct connectdata *conn) if(Curl_base64_encode(conn->data, (char *)tktcopy.dat, tktcopy.length, &p) < 1) { failf(conn->data, "Out of memory base64-encoding."); - Curl_set_command_prot(conn, save); + krb4_set_command_prot(conn, save); return CURLE_OUT_OF_MEMORY; } memset (tktcopy.dat, 0, tktcopy.length); @@ -413,7 +421,7 @@ CURLcode Curl_krb_kauth(struct connectdata *conn) result = Curl_GetFTPResponse(&nread, conn, NULL); if(result) return result; - Curl_set_command_prot(conn, save); + krb4_set_command_prot(conn, save); return CURLE_OK; } diff --git a/lib/krb4.h b/lib/krb4.h index 5da1dc6ef..09e7b27a5 100644 --- a/lib/krb4.h +++ b/lib/krb4.h @@ -60,11 +60,6 @@ void Curl_sec_end (struct connectdata *); CURLcode Curl_sec_login (struct connectdata *); void Curl_sec_prot (int, char **); int Curl_sec_request_prot (struct connectdata *conn, const char *level); -int Curl_sec_set_protection_level(struct connectdata *conn); void Curl_sec_status (void); -enum protection_level Curl_set_command_prot(struct connectdata *, - enum protection_level); - - #endif diff --git a/lib/security.c b/lib/security.c index 73a554016..244ab6fee 100644 --- a/lib/security.c +++ b/lib/security.c @@ -399,16 +399,8 @@ int Curl_sec_read_msg(struct connectdata *conn, char *buffer, int level) return ret_code; } -enum protection_level -Curl_set_command_prot(struct connectdata *conn, enum protection_level level) -{ - enum protection_level old = conn->command_prot; - conn->command_prot = level; - return old; -} - /* FIXME: The error code returned here is never checked. */ -int Curl_sec_set_protection_level(struct connectdata *conn) +static int sec_set_protection_level(struct connectdata *conn) { int code; char* pbsz; @@ -551,7 +543,7 @@ static CURLcode choose_mech(struct connectdata *conn) conn->command_prot = prot_safe; /* Set the requested protection level */ /* BLOCKING */ - Curl_sec_set_protection_level(conn); + (void)sec_set_protection_level(conn); break; } |