]> git.evergreen-ils.org Git - Evergreen.git/commit
Big cleanup of the C auth app from Scott McKellar:
authormiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 26 Nov 2007 18:25:09 +0000 (18:25 +0000)
committermiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 26 Nov 2007 18:25:09 +0000 (18:25 +0000)
commit1ae174ddb78bd56bcbc9e17a9fe7d04febce5146
treef9be1575b523aaae8cc8131853c292cdd056e4b0
parent9fbe999bdd9e842445bf194a92da935029825188
Big cleanup of the C auth app from Scott McKellar:

1. Apply the const qualifier where possible.

2. Plug memory leaks.

3. Make some global things static.

4. Some minor tidying-up.

Details:

1. The variables __oilsAuthOPACTimeout, __oilsAuthStaffTimeout and
and __oilsAuthOverrideTimeout are now static, since no other file
references them.  Also I reduced the leading underscores to one each.

2. In several places I replaced jsonObjectGetKey() with
jsonObjectGetKeyConst().

3. In oilsAuthInit(): I plugged a memory leak by moving the freeing
of username out of an else block and into the code following.

4. In oilsAuthVerifyPassword(): I plugged a memory leak in the case
of an early return.

5. In oilsAuthVerifyWorkstation: I plugged a memory leak by freeing
workstation at the end.

6. In oilsAuthCheckCard(): I eliminated the ctx and userObj parameters.
The function didn't do anything with them except to verify that they
weren't NULL.  I transferred that responsibility to the calling code
in oilsAuthComplete() (where I also plugged another memory leak).

7. Also in oilsAuthCheckCard(): I plugged a memory leak by freeing
params and card.  Also I rearranged the last few lines a bit so that
we free active in only one place.

8. In oilsAuthComplete(): I plugged a number of memory leaks caused
by a failure to free userObj in various early returns.

9. Also in oilsAuthComplete(): In order to be able make uname a const
pointer, but still be able to delete it when necessary, I created an
intermdiate non-const pointer named freeable_uname -- which also takes
the place of the original freeuname variable used as a boolean.

10. In oilsAuthSessionRetrieve(): I moved the freeing of evt out of
the if-else structure and put it at the end, to make sure that none
of the branches would miss it.

11. Also in oilsAuthSessionRetrieve(): one of the branches of the
if-else had a second variable named evt, hiding the variable of the
same name declared in an enclosing scope.  That's not a bug, but it's
confusing.  I renamed it to evt2.

12. The following functions are now static:

   oilsAuthCheckLoginPerm()
   oilsAuthVerifyPassword()
   oilsAuthGetTimeout()
   oilsAuthHandleLoginOK()
   oilsAuthVerifyWorkstation()
   _oilsAuthResetTimeout()

13. I added the const qualifier to various parameters and local
variables.

git-svn-id: svn://svn.open-ils.org/ILS/trunk@8115 dcc99617-32d9-48b4-a31d-7c20da2025e4
Open-ILS/src/c-apps/oils_auth.c