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

With every log-in: realpath() cannot resolve path "" #277

Closed
rdmark opened this issue Apr 5, 2023 · 4 comments
Closed

With every log-in: realpath() cannot resolve path "" #277

rdmark opened this issue Apr 5, 2023 · 4 comments

Comments

@rdmark
Copy link
Member

rdmark commented Apr 5, 2023

Since the change in #212 I'm seeing this once every time a user connects to an afp volume:

afpd[15035]: realpath() cannot resolve path ""

So there is code somewhere that tries to resolve an null string path. Doesn't seem fatal, but arguably a bit unclean. While figuring this out, perhaps lowering the log level to warning is apt.

@rdmark rdmark changed the title With every log-in: afpd[15035]: realpath() cannot resolve path "" With every log-in: realpath() cannot resolve path "" Apr 5, 2023
@rdmark
Copy link
Member Author

rdmark commented Apr 5, 2023

To tweak the log level: #279

@dgsga
Copy link
Contributor

dgsga commented Apr 6, 2023

The relevant code is present in the realpath_safe() function, starting at line 438 of libatalk/util/unix.c. Realpath_safe() is called in etc/afpd/fce_api.c and libatalk/util/netatalk_conf.c...

@rdmark
Copy link
Member Author

rdmark commented Apr 8, 2023

Thanks for tracking down the usage of the code. I narrowed it down to etc/afpd/fce_api.c where fce_register() is called with an empty string for path in etc/afpd/auth.c.

fce_register(obj, FCE_LOGIN, "", NULL);

That empty string is then passed to realpath_safe()

In fact, there are two places in auth.c where fce_register() is called with an empty string: once for login once for logout.

Elsewhere in the codebase, fce_register() is always called with a path string, so the issue seems to be isolated to this spot in the code.

@rdmark
Copy link
Member Author

rdmark commented Apr 8, 2023

Found a simple fix: move the path lookups closer to where they're actually used in that function. This allow fce_register() to validate if listeners are configured, which they aren't at this stage, and return with AFP_OK before the path lookup.

#292

@rdmark rdmark closed this as completed Apr 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants