Skip to content
This repository has been archived by the owner on Feb 28, 2024. It is now read-only.

Introduce session params #78

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

pprindeville
Copy link
Collaborator

Note: This fix needs to be rebased after PR #72 is merged.

If you have a process which involves multiple simultaneous connections to different Tacacs+ servers (with different parameters, such as the secret, the session-id, the sequence #, etc) then having these values stored in globals is a severe hindrance.

This changeset presents a simplification of the API, containing all per-session data in a per-session object.

It also means that as new parameters get added in the future, this can be done with less source-level churn (though a version bump and recompile will still be required).

Lastly, there's the possibility of allocating extra data at the end of the session object for user-defined information to be stored; this could be as simple as a pointer to another object, or an entire nested object:

    sess = tac_session_alloc_extra(sizeof(*cookie));
    cookie = tac_session_get_user_data(sess);
    cookie->server_no = n;
    cookie->callback = got_response;

The callback data will be more useful in a subsequent patch which introduces event-driven querying using libevent but was introduced here since the tac_session is being introduced here.

@pprindeville
Copy link
Collaborator Author

Still have more PR's to submit, but they are all predicated on the outstanding (unmerged) PR's.

@pprindeville pprindeville force-pushed the introduce-session-params branch 3 times, most recently from 9a4ee3f to 3e8cff6 Compare November 11, 2016 17:59
@pprindeville
Copy link
Collaborator Author

Only the last 2 commits apply: the rest are from branching from redux-packet-marshalling and will go away with a rebase once that gets merged to master.

@pprindeville pprindeville force-pushed the introduce-session-params branch 2 times, most recently from 3e44f9c to ecc89a2 Compare December 3, 2016 01:54
@pprindeville pprindeville force-pushed the introduce-session-params branch from ecc89a2 to cd5da0c Compare December 3, 2016 02:20
@pprindeville
Copy link
Collaborator Author

Rebased to PR #72 after it was rebased to master today.

@pprindeville pprindeville mentioned this pull request Dec 5, 2016
@pprindeville
Copy link
Collaborator Author

pprindeville commented Dec 5, 2016

Merge PR #80, #72, and #82 (in that order) before this one.

@pprindeville pprindeville force-pushed the introduce-session-params branch 2 times, most recently from 925ddfe to b2d3c0d Compare December 8, 2016 01:22
@pprindeville pprindeville force-pushed the introduce-session-params branch from 8dc155e to a498511 Compare December 8, 2016 23:52
This was referenced Dec 8, 2016
Derive the authentication type from tac_login string
It's precursory to separate marshalling functions from I/O if
event-driven I/O is to be done, or if multiple Tacacs+ sessions
can be active at the same time (you don't want to be polling on
one socket and miss a timeout on another).
Unnecessary casts are a blight in that they mask possible programming
errors.  We shouldn't use them where they aren't required.

Also, add a convenience function to convert a header pointer to a
body pointer by adding the correct offset.
If you're connecting to multiple servers simultaneously, then
per-server parameters can't be globals.  Move them into a
session container.

Note: this obviously has API and ABI compatibility implications.
As this is obviously related to the session.
@pprindeville pprindeville force-pushed the introduce-session-params branch from a498511 to c0a0c3d Compare December 21, 2016 03:10
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant