cleaned up some picky compiler warnings and indented the code curl style
This commit is contained in:
parent
95e7e551f6
commit
8e1f95ac7d
@ -73,45 +73,15 @@ static struct {
|
|||||||
{ prot_private, "private" }
|
{ prot_private, "private" }
|
||||||
};
|
};
|
||||||
|
|
||||||
#if 0
|
|
||||||
static const char *
|
|
||||||
level_to_name(enum protection_level level)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
for(i = 0; i < sizeof(level_names) / sizeof(level_names[0]); i++)
|
|
||||||
if(level_names[i].level == level)
|
|
||||||
return level_names[i].name;
|
|
||||||
return "unknown";
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef FTP_SERVER /* not used in server */
|
|
||||||
static enum protection_level
|
static enum protection_level
|
||||||
name_to_level(const char *name)
|
name_to_level(const char *name)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for(i = 0; i < sizeof(level_names) / sizeof(level_names[0]); i++)
|
for(i = 0; i < (int)sizeof(level_names)/(int)sizeof(level_names[0]); i++)
|
||||||
if(!strncasecmp(level_names[i].name, name, strlen(name)))
|
if(!strncasecmp(level_names[i].name, name, strlen(name)))
|
||||||
return level_names[i].level;
|
return level_names[i].level;
|
||||||
return (enum protection_level)-1;
|
return (enum protection_level)-1;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef FTP_SERVER
|
|
||||||
|
|
||||||
static struct sec_server_mech *mechs[] = {
|
|
||||||
#ifdef KRB5
|
|
||||||
&gss_server_mech,
|
|
||||||
#endif
|
|
||||||
#ifdef KRB4
|
|
||||||
&krb4_server_mech,
|
|
||||||
#endif
|
|
||||||
NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
static struct sec_server_mech *mech;
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
static struct sec_client_mech *mechs[] = {
|
static struct sec_client_mech *mechs[] = {
|
||||||
#ifdef KRB5
|
#ifdef KRB5
|
||||||
@ -125,8 +95,6 @@ static struct sec_client_mech *mechs[] = {
|
|||||||
|
|
||||||
static struct sec_client_mech *mech;
|
static struct sec_client_mech *mech;
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int
|
int
|
||||||
sec_getc(struct connectdata *conn, FILE *F)
|
sec_getc(struct connectdata *conn, FILE *F)
|
||||||
{
|
{
|
||||||
@ -135,7 +103,8 @@ sec_getc(struct connectdata *conn, FILE *F)
|
|||||||
if(sec_read(conn, fileno(F), &c, 1) <= 0)
|
if(sec_read(conn, fileno(F), &c, 1) <= 0)
|
||||||
return EOF;
|
return EOF;
|
||||||
return c;
|
return c;
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
return getc(F);
|
return getc(F);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -173,7 +142,7 @@ block_write(int fd, void *buf, size_t len)
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
sec_get_data(struct connectdata *conn,
|
sec_get_data(struct connectdata *conn,
|
||||||
int fd, struct krb4buffer *buf, int level)
|
int fd, struct krb4buffer *buf)
|
||||||
{
|
{
|
||||||
int len;
|
int len;
|
||||||
int b;
|
int b;
|
||||||
@ -244,7 +213,7 @@ sec_read(struct connectdata *conn, int fd, void *buffer, int length)
|
|||||||
buffer = (char*)buffer + len;
|
buffer = (char*)buffer + len;
|
||||||
|
|
||||||
while(length) {
|
while(length) {
|
||||||
if(sec_get_data(conn, fd, &conn->in_buffer, conn->data_prot) < 0)
|
if(sec_get_data(conn, fd, &conn->in_buffer) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
if(conn->in_buffer.size == 0) {
|
if(conn->in_buffer.size == 0) {
|
||||||
if(rx)
|
if(rx)
|
||||||
@ -474,7 +443,7 @@ sec_prot_internal(struct connectdata *conn, int level)
|
|||||||
{
|
{
|
||||||
char *p;
|
char *p;
|
||||||
unsigned int s = 1048576;
|
unsigned int s = 1048576;
|
||||||
size_t nread;
|
ssize_t nread;
|
||||||
|
|
||||||
if(!conn->sec_complete){
|
if(!conn->sec_complete){
|
||||||
infof(conn->data, "No security data exchange has taken place.\n");
|
infof(conn->data, "No security data exchange has taken place.\n");
|
||||||
@ -577,7 +546,7 @@ sec_set_protection_level(struct connectdata *conn)
|
|||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
sec_request_prot(struct connectdata *conn, char *level)
|
sec_request_prot(struct connectdata *conn, const char *level)
|
||||||
{
|
{
|
||||||
int l = name_to_level(level);
|
int l = name_to_level(level);
|
||||||
if(l == -1)
|
if(l == -1)
|
||||||
@ -591,7 +560,7 @@ sec_login(struct connectdata *conn)
|
|||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
struct sec_client_mech **m;
|
struct sec_client_mech **m;
|
||||||
size_t nread;
|
ssize_t nread;
|
||||||
struct UrlData *data=conn->data;
|
struct UrlData *data=conn->data;
|
||||||
|
|
||||||
for(m = mechs; *m && (*m)->name; m++) {
|
for(m = mechs; *m && (*m)->name; m++) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user