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

utmp(x) (cross)compilation error since 2022.82 #153

Closed
selanf opened this issue Apr 1, 2022 · 8 comments
Closed

utmp(x) (cross)compilation error since 2022.82 #153

selanf opened this issue Apr 1, 2022 · 8 comments

Comments

@selanf
Copy link

selanf commented Apr 1, 2022

loginrec.c: In function 'utmpx_perform_login':
loginrec.c:832:31: error: 'ut' undeclared (first use in this function); did you mean 'utx'?
  if (!utmpx_write_direct(li, &ut)) {
                               ^~
                               utx
loginrec.c:832:31: note: each undeclared identifier is reported only once for each function it appears in

Workaround: --disable-utmp --disable-utmpx

@mkj
Copy link
Owner

mkj commented Apr 2, 2022

What platform is that compiling on?

@selanf
Copy link
Author

selanf commented Apr 2, 2022

It's mips with uClibc. The full output: build.txt

I noticed:
checking for struct utmpx.ut_syslen... no
checking for struct utmpx.ut_addr... no
checking for struct utmpx.ut_time... no

@mkj
Copy link
Owner

mkj commented Apr 2, 2022

Hm, loginrec.c hasn't changed for a long time, and OpenSSH's copy (where it came from) still has the same thing. So I guess that code path doesn't usually get hit. Perhaps something strange is going on with configure. Did it work OK in previous Dropbear versions? I can't think what would have changed.

@mkj
Copy link
Owner

mkj commented Apr 2, 2022

Forgot to add, which exact toolchain are you using?

@selanf
Copy link
Author

selanf commented Apr 4, 2022

This for FritzBox 7590: https://github.com/Freetz-NG/freetz-ng
With previous 2020.81 it worked

@selanf
Copy link
Author

selanf commented Apr 4, 2022

A diff of the configure output:

-2020.81
+2022.82

-checking for ANSI C header files... (cached) yes
+checking sys/prctl.h usability... yes
+checking sys/prctl.h presence... yes
+checking for sys/prctl.h... yes
-checking whether time.h and sys/time.h may both be included... (cached) yes
-checking if your system defines UTMPX_FILE... no
+checking if your system defines UTMPX_FILE... yes
-checking if your system defines WTMPX_FILE... no
+checking if your system defines WTMPX_FILE... yes
+checking for fexecve... yes
+config.status: creating test/Makefile

@selanf
Copy link
Author

selanf commented Apr 4, 2022

So it worked with .81 because wtmpx was not found and thus disabled in dropbear, it was never used. Configure of .82 find the file and enables it and fails.

Is this part of dropbear's "loginrec.c" okay?

static int
utmpx_perform_login(struct logininfo *li)
{
	struct utmpx utx;
#####                ^^^

	construct_utmpx(li, &utx);
# ifdef UTMPX_USE_LIBRARY
	if (!utmpx_write_library(li, &utx)) {
#####                                ^^^
		dropbear_log(LOG_WARNING, "utmpx_perform_login: utmp_write_library() failed");
		return 0;
	}
# else
	if (!utmpx_write_direct(li, &ut)) {
#####                                ^^
		dropbear_log(LOG_WARNING, "utmpx_perform_login: utmp_write_direct() failed");
		return 0;
	}
# endif
	return 1;
}

Thats what the error above shows

@mkj
Copy link
Owner

mkj commented Nov 9, 2022

This was fixed in #189

Sorry I'd forgotten about this issue - your comment about configure explains my question why it only started happening.

@mkj mkj closed this as completed Nov 9, 2022
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