finger: detect mail status locally #41

Closed
opened 2026-02-12 06:03:06 +01:00 by oysteikt · 1 comment
Owner

We need to support looking at the mailboxes/maildirs of the users, and seeing what status they have (for feature parity with the classic finger implementations)

We need to support looking at the mailboxes/maildirs of the users, and seeing what status they have (for feature parity with the classic finger implementations)
oysteikt added this to the Finger support parity milestone 2026-02-12 06:03:06 +01:00
oysteikt added the feature request label 2026-02-12 06:03:06 +01:00
Author
Owner

Relevant code, pw is a passwd entry, TBUFLEN = 1024 and _PATH_MAILDIR seems to come from paths.h, possibly /var/mail?

	pn->mailrecv = -1;		/* -1 == not_valid */
	pn->mailread = -1;		/* -1 == not_valid */

	snprintf(tbuf, TBUFLEN, "%s/%s", _PATH_MAILDIR, pw->pw_name);
	if (stat(tbuf, &sb) < 0) {
		if (errno != ENOENT) {
			eprintf("finger: %s: %s\n", tbuf, strerror(errno));
			return;
		}
	} 
	else if (sb.st_size != 0) {
		pn->mailrecv = sb.st_mtime;
		pn->mailread = sb.st_atime;
	}
Relevant code, `pw` is a passwd entry, `TBUFLEN = 1024` and `_PATH_MAILDIR` seems to come from `paths.h`, [possibly `/var/mail`](https://codebrowser.dev/glibc/glibc/sysdeps/unix/sysv/linux/paths.h.html)? ```c pn->mailrecv = -1; /* -1 == not_valid */ pn->mailread = -1; /* -1 == not_valid */ snprintf(tbuf, TBUFLEN, "%s/%s", _PATH_MAILDIR, pw->pw_name); if (stat(tbuf, &sb) < 0) { if (errno != ENOENT) { eprintf("finger: %s: %s\n", tbuf, strerror(errno)); return; } } else if (sb.st_size != 0) { pn->mailrecv = sb.st_mtime; pn->mailread = sb.st_atime; } ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Projects/roowho2#41