diff options
author | Stef Walter <stef@memberwebs.com> | 2004-08-17 20:59:04 +0000 |
---|---|---|
committer | Stef Walter <stef@memberwebs.com> | 2004-08-17 20:59:04 +0000 |
commit | d92564c87818157b09ddfbf3314406b765ca390a (patch) | |
tree | dc37024dded77c30d769852cce0952f1b886f36c /daemon/ntlm.c | |
parent | 4af582bf3aa65e0a4ebb5723047c4d1e94d12f15 (diff) |
- Changed 'goto finally' to RETURN(xx)
- Added MYSQL support and tested it.
Diffstat (limited to 'daemon/ntlm.c')
-rw-r--r-- | daemon/ntlm.c | 43 |
1 files changed, 16 insertions, 27 deletions
diff --git a/daemon/ntlm.c b/daemon/ntlm.c index 63d4580..ab6e5e4 100644 --- a/daemon/ntlm.c +++ b/daemon/ntlm.c @@ -310,14 +310,14 @@ int ntlm_auth_ntlm(ha_request_t* rq, ntlm_context_t* ctx, void* key, d = ha_bufdec64(rq->buf, header, &len); if(!d || len == 0) - goto finally; + RETURN(HA_FALSE); r = ntlmssp_decode_msg(&ntlmssp, d, len, &flags); if(r != 0) { ha_messagex(rq, LOG_WARNING, "decoding NTLMSSP message failed (error %d)", r); rq->resp_code = HA_SERVER_BADREQ; - goto finally; + RETURN(HA_FALSE); } @@ -350,16 +350,13 @@ int ntlm_auth_ntlm(ha_request_t* rq, ntlm_context_t* ctx, void* key, conn = NULL; if(r < 0) - { - ret = HA_CRITERROR; - } + RETURN(HA_CRITERROR); else { ha_messagex(rq, LOG_ERR, "received out of order NTLM request from client"); rq->resp_code = HA_SERVER_BADREQ; + RETURN(HA_FALSE); } - - goto finally; } @@ -386,10 +383,7 @@ int ntlm_auth_ntlm(ha_request_t* rq, ntlm_context_t* ctx, void* key, conn = makeconnection(rq, ctx); if(!conn) - { - ret = HA_FAILED; - goto finally; - } + RETURN(HA_FAILED); /* Save away any flags given us by ntlm_decode_msg */ conn->flags = flags; @@ -413,7 +407,7 @@ int ntlm_auth_ntlm(ha_request_t* rq, ntlm_context_t* ctx, void* key, } if(ha_buferr(rq->buf)) - goto finally; + RETURN(HA_FALSE); /* * TODO: Our callers need to be able to keep alive @@ -431,16 +425,14 @@ int ntlm_auth_ntlm(ha_request_t* rq, ntlm_context_t* ctx, void* key, conn = NULL; if(r < 0) - { - ret = HA_CRITERROR; - } + RETURN(HA_CRITERROR); else { ha_messagex(rq, LOG_DEBUG, "sending ntlm challenge"); ha_addheader(rq, "WWW-Authenticate", ha_bufdata(rq->buf)); rq->resp_code = HA_SERVER_DECLINE; + RETURN(HA_FALSE); } - goto finally; } /* A response to a challenge */ @@ -457,14 +449,14 @@ int ntlm_auth_ntlm(ha_request_t* rq, ntlm_context_t* ctx, void* key, { ha_messagex(rq, LOG_WARNING, "received out of order NTLM response from client"); rq->resp_code = HA_SERVER_BADREQ; - goto finally; + RETURN(HA_FALSE); } if(!ntlmssp.user) { ha_messagex(rq, LOG_WARNING, "received NTLM response without user name"); rq->resp_code = HA_SERVER_BADREQ; - goto finally; + RETURN(HA_FALSE); } /* We have to lock while going into smblib */ @@ -485,7 +477,7 @@ int ntlm_auth_ntlm(ha_request_t* rq, ntlm_context_t* ctx, void* key, * caller to put in all the proper headers for us. */ ha_messagex(rq, LOG_WARNING, "failed NTLM logon for user '%s'", ntlmssp.user); - ret = HA_FALSE; + RETURN(HA_FALSE); } /* A successful login ends here */ @@ -505,21 +497,18 @@ int ntlm_auth_ntlm(ha_request_t* rq, ntlm_context_t* ctx, void* key, if(!r) { ha_messagex(NULL, LOG_CRIT, "out of memory"); - ret = HA_CRITERROR; - } - else - { - ret = HA_OK; + RETURN(HA_CRITERROR); } - } - goto finally; + RETURN(HA_OK); + } } + break; default: ha_messagex(rq, LOG_WARNING, "received invalid NTLM message (type %d)", ntlmssp.msg_type); rq->resp_code = HA_SERVER_BADREQ; - goto finally; + RETURN(HA_FALSE); }; |