mirror of
https://github.com/curl/curl.git
synced 2025-09-28 23:16:48 +03:00
krb4: make a few functions static
This commit is contained in:
parent
2261ddf9db
commit
0152dbbe23
24
lib/krb4.c
24
lib/krb4.c
|
@ -7,7 +7,7 @@
|
||||||
*
|
*
|
||||||
* Copyright (c) 1995, 1996, 1997, 1998, 1999 Kungliga Tekniska Högskolan
|
* Copyright (c) 1995, 1996, 1997, 1998, 1999 Kungliga Tekniska Högskolan
|
||||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||||
* Copyright (c) 2004 - 2009 Daniel Stenberg
|
* Copyright (c) 2004 - 2010 Daniel Stenberg
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* 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
|
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)
|
CURLcode Curl_krb_kauth(struct connectdata *conn)
|
||||||
{
|
{
|
||||||
des_cblock key;
|
des_cblock key;
|
||||||
|
@ -329,7 +337,7 @@ CURLcode Curl_krb_kauth(struct connectdata *conn)
|
||||||
CURLcode result;
|
CURLcode result;
|
||||||
unsigned char *ptr;
|
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);
|
result = Curl_ftpsendf(conn, "SITE KAUTH %s", conn->user);
|
||||||
|
|
||||||
|
@ -341,14 +349,14 @@ CURLcode Curl_krb_kauth(struct connectdata *conn)
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
if(conn->data->state.buffer[0] != '3'){
|
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;
|
return CURLE_FTP_WEIRD_SERVER_REPLY;
|
||||||
}
|
}
|
||||||
|
|
||||||
p = strstr(conn->data->state.buffer, "T=");
|
p = strstr(conn->data->state.buffer, "T=");
|
||||||
if(!p) {
|
if(!p) {
|
||||||
Curl_failf(conn->data, "Bad reply from server");
|
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;
|
return CURLE_FTP_WEIRD_SERVER_REPLY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -360,7 +368,7 @@ CURLcode Curl_krb_kauth(struct connectdata *conn)
|
||||||
}
|
}
|
||||||
if(!tmp || !ptr) {
|
if(!tmp || !ptr) {
|
||||||
Curl_failf(conn->data, "Failed to decode base64 in reply");
|
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;
|
return CURLE_FTP_WEIRD_SERVER_REPLY;
|
||||||
}
|
}
|
||||||
memcpy((char *)tkt.dat, ptr, tmp);
|
memcpy((char *)tkt.dat, ptr, tmp);
|
||||||
|
@ -371,7 +379,7 @@ CURLcode Curl_krb_kauth(struct connectdata *conn)
|
||||||
p = strstr(conn->data->state.buffer, "P=");
|
p = strstr(conn->data->state.buffer, "P=");
|
||||||
if(!p) {
|
if(!p) {
|
||||||
Curl_failf(conn->data, "Bad reply from server");
|
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;
|
return CURLE_FTP_WEIRD_SERVER_REPLY;
|
||||||
}
|
}
|
||||||
name = p + 2;
|
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)
|
if(Curl_base64_encode(conn->data, (char *)tktcopy.dat, tktcopy.length, &p)
|
||||||
< 1) {
|
< 1) {
|
||||||
failf(conn->data, "Out of memory base64-encoding.");
|
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;
|
return CURLE_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
memset (tktcopy.dat, 0, tktcopy.length);
|
memset (tktcopy.dat, 0, tktcopy.length);
|
||||||
|
@ -413,7 +421,7 @@ CURLcode Curl_krb_kauth(struct connectdata *conn)
|
||||||
result = Curl_GetFTPResponse(&nread, conn, NULL);
|
result = Curl_GetFTPResponse(&nread, conn, NULL);
|
||||||
if(result)
|
if(result)
|
||||||
return result;
|
return result;
|
||||||
Curl_set_command_prot(conn, save);
|
krb4_set_command_prot(conn, save);
|
||||||
|
|
||||||
return CURLE_OK;
|
return CURLE_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,11 +60,6 @@ void Curl_sec_end (struct connectdata *);
|
||||||
CURLcode Curl_sec_login (struct connectdata *);
|
CURLcode Curl_sec_login (struct connectdata *);
|
||||||
void Curl_sec_prot (int, char **);
|
void Curl_sec_prot (int, char **);
|
||||||
int Curl_sec_request_prot (struct connectdata *conn, const char *level);
|
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);
|
void Curl_sec_status (void);
|
||||||
|
|
||||||
enum protection_level Curl_set_command_prot(struct connectdata *,
|
|
||||||
enum protection_level);
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -399,16 +399,8 @@ int Curl_sec_read_msg(struct connectdata *conn, char *buffer, int level)
|
||||||
return ret_code;
|
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. */
|
/* 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;
|
int code;
|
||||||
char* pbsz;
|
char* pbsz;
|
||||||
|
@ -551,7 +543,7 @@ static CURLcode choose_mech(struct connectdata *conn)
|
||||||
conn->command_prot = prot_safe;
|
conn->command_prot = prot_safe;
|
||||||
/* Set the requested protection level */
|
/* Set the requested protection level */
|
||||||
/* BLOCKING */
|
/* BLOCKING */
|
||||||
Curl_sec_set_protection_level(conn);
|
(void)sec_set_protection_level(conn);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user