This repository has been archived by the owner on Feb 28, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 101
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Let the connections to servers be event-driven by libevent.
- Loading branch information
1 parent
c0a0c3d
commit 898f17c
Showing
8 changed files
with
611 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
prefix=@prefix@ | ||
exec_prefix=@exec_prefix@ | ||
libdir=@libdir@ | ||
includedir=@includedir@/libtac | ||
|
||
Name: libtac-event | ||
Description: A TACACS+ protocol implementation | ||
URL: https://github.com/jeroennijhof/pam_tacplus | ||
Version: @VERSION@ | ||
Libs: -L${libdir} -ltac-event | ||
Cflags: -I${includedir} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/* parse.c - Callback for dispatching received packets | ||
* | ||
* Copyright (C) 2016, Philip Prindeville <[email protected]> | ||
* Copyright (C) 2016, Brocade Communications Systems, Inc. | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 2 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program - see the file COPYING. | ||
* | ||
* See `CHANGES' file for revision history. | ||
*/ | ||
|
||
#include <stdio.h> | ||
|
||
#include "libtac.h" | ||
|
||
void tac_parse_pkt(struct tac_session *sess, struct cb_ctx *ctx, u_char *pkt, unsigned len) | ||
{ | ||
HDR *th = (HDR *)pkt; | ||
int status = -1; | ||
struct areply re = { 0 }; | ||
|
||
switch (th->type) { | ||
case TAC_PLUS_AUTHEN: | ||
TACDEBUG(LOG_DEBUG, "session %p got authen %u bytes", sess, len); | ||
status = tac_authen_parse(sess, &re, pkt, len); | ||
break; | ||
|
||
case TAC_PLUS_AUTHOR: | ||
TACDEBUG(LOG_DEBUG, "session %p got author %u bytes", sess, len); | ||
status = tac_author_parse(sess, pkt, len, &re); | ||
break; | ||
|
||
case TAC_PLUS_ACCT: | ||
TACDEBUG(LOG_DEBUG, "session %p got account %u bytes", sess, len); | ||
status = tac_acct_parse(sess, pkt, len, &re); | ||
break; | ||
|
||
default: | ||
TACDEBUG(LOG_INFO, "session %p got %u byte packet of %02x type; ignoring", \ | ||
sess, len, th->type); | ||
|
||
break; | ||
} | ||
|
||
if (sess->response_cb) { | ||
TACDEBUG(LOG_DEBUG, "session %p user callback", sess); | ||
sess->response_cb(sess, ctx, status, th->type, &re); | ||
} | ||
|
||
tac_free_attrib(&re.attr); | ||
free(re.msg); | ||
free(re.data); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.