dropbear icon indicating copy to clipboard operation
dropbear copied to clipboard

utmp(x) (cross)compilation error since 2022.82

Open selanf opened this issue 3 years ago • 7 comments

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

selanf avatar Apr 01 '22 16:04 selanf

What platform is that compiling on?

mkj avatar Apr 02 '22 06:04 mkj

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

selanf avatar Apr 02 '22 07:04 selanf

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 avatar Apr 02 '22 12:04 mkj

Forgot to add, which exact toolchain are you using?

mkj avatar Apr 02 '22 12:04 mkj

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

selanf avatar Apr 04 '22 16:04 selanf

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 avatar Apr 04 '22 16:04 selanf

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

selanf avatar Apr 04 '22 18:04 selanf

This was fixed in https://github.com/mkj/dropbear/pull/189

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

mkj avatar Nov 09 '22 05:11 mkj