summaryrefslogtreecommitdiff
path: root/libtac/lib/acct_s.c
diff options
context:
space:
mode:
authorJeroen <jeroen@nijhofnet.nl>2011-08-19 23:00:05 +0200
committerJeroen <jeroen@nijhofnet.nl>2011-08-19 23:00:05 +0200
commit638486dec6577299c7d8282da4b2f02fc9871bbd (patch)
tree763974070ab0675740ec2966b9f64e123d2a7e33 /libtac/lib/acct_s.c
parentd1134977b9317c6161ae12608684ea857915a63c (diff)
downloadpam_tacplus-638486dec6577299c7d8282da4b2f02fc9871bbd.tar.gz
pam_tacplus-638486dec6577299c7d8282da4b2f02fc9871bbd.zip
Finally got rid of all goto illness!
Diffstat (limited to 'libtac/lib/acct_s.c')
-rw-r--r--libtac/lib/acct_s.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/libtac/lib/acct_s.c b/libtac/lib/acct_s.c
index dd3dff9..51d2715 100644
--- a/libtac/lib/acct_s.c
+++ b/libtac/lib/acct_s.c
@@ -46,7 +46,7 @@ int tac_account_send(int fd, int type, const char *user, char *tty,
/* u_char *pktp; */ /* obsolute */
int ret = 0;
- th=_tac_req_header(TAC_PLUS_ACCT, 0);
+ th = _tac_req_header(TAC_PLUS_ACCT, 0);
/* set header options */
th->version=TAC_PLUS_VER_0;
@@ -64,7 +64,7 @@ int tac_account_send(int fd, int type, const char *user, char *tty,
tb.flags=(u_char) type;
tb.authen_method=tac_authen_method;
tb.priv_lvl=tac_priv_lvl;
- if(strcmp(tac_login,"chap") == 0) {
+ if (strcmp(tac_login,"chap") == 0) {
tb.authen_type=TAC_PLUS_AUTHEN_TYPE_CHAP;
} else if(strcmp(tac_login,"login") == 0) {
tb.authen_type=TAC_PLUS_AUTHEN_TYPE_ASCII;
@@ -82,7 +82,7 @@ int tac_account_send(int fd, int type, const char *user, char *tty,
/* fill attribute length fields */
a = attr;
- while(a) {
+ while (a) {
pktl = pkt_len;
pkt_len += sizeof(a->attr_len);
pkt = (u_char*) xrealloc(pkt, pkt_len);
@@ -132,13 +132,14 @@ int tac_account_send(int fd, int type, const char *user, char *tty,
th->datalength = htonl(pkt_len);
/* write header */
- w=write(fd, th, TAC_PLUS_HDR_SIZE);
+ w = write(fd, th, TAC_PLUS_HDR_SIZE);
if(w < TAC_PLUS_HDR_SIZE) {
TACSYSLOG((LOG_ERR, "%s: short write on header, wrote %d of %d: %m",\
__FUNCTION__, w, TAC_PLUS_HDR_SIZE))
- ret = LIBTAC_STATUS_WRITE_ERR;
- goto AcctExit;
+ free(pkt);
+ free(th);
+ return LIBTAC_STATUS_WRITE_ERR;
}
/* encrypt packet body */
@@ -152,9 +153,8 @@ int tac_account_send(int fd, int type, const char *user, char *tty,
ret = LIBTAC_STATUS_WRITE_ERR;
}
-AcctExit:
free(pkt);
free(th);
TACDEBUG((LOG_DEBUG, "%s: exit status=%d", __FUNCTION__, ret))
- return(ret);
+ return ret;
}