Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pppCleanup() not called when user lacks ~/.pppauth directory #21

Open
GoogleCodeExporter opened this issue Sep 2, 2015 · 0 comments
Open

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1. Login with user without ~/.pppauth directory

SVN version.

Please provide any additional information below.

When readKeyFile() fails after pppInit() is done there's no call 
to pppCleanup() which cause soft to leak 32 bytes at:
==7209== 32 bytes in 1 blocks are definitely lost in loss record 5 of 5
==7209==    at 0x4022C3B: calloc (in
/usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==7209==    by 0x804A008: mp_init_size (mpi.c:284)
==7209==    by 0x8049F2E: mp_init (mpi.c:238)
==7209==    by 0x8049933: readKeyFile (keyfiles.c:352)
==7209==    by 0x8048EFF: pam_sm_authenticate (memtest.c:56)
==7209==    by 0x8048FED: main (memtest.c:110)

UPDATE: it's also readKeyFile() which calls mp_init, but won't call
mp_clear on error. Also it might sometimes not zero buf, which holds the key.

I did a .c file which simulates logins without help of PAM so I can run it
on valgrind; that's the only case of leak I've found so far. I'm not
entirely sure how PAM works, but I think that this leak wouldn't lead to
some big memory usage on long-running systems (in sshd?) therefore this
leak might not be so important, yet it would be nice to patch it up.

Setting user to NULL at exit of pam_sm_authenticate doesn't do anything
important as I think, so possible fix, using common goto-method is in
attached patch. (Also fixed whitespace 4 spaces vs. tab and removed drop of
const keyword on const char *user; will work fine if setUser prototype is
changed to accept const (as in my previous patch) ).

Original issue reported on code.google.com by TomaszFo...@gmail.com on 7 Nov 2009 at 9:45

Attachments:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant