#include <freeradius-devel/sysutmp.h>
#include <freeradius-devel/radutmp.h>
+#ifdef HAVE_PWD_H
#include <pwd.h>
+#endif
+
#include <sys/stat.h>
-#include <sys/utsname.h>
+
#include <ctype.h>
/*
* Header above output and format.
*/
static const char *hdr1 =
-"Login Name What TTY When From Location";
-static const char *rfmt1 = "%-10.10s %-17.17s %-5.5s %s%-3u %-9.9s %-9.9s %-.19s%s";
+"Login Name What TTY When From Location";
+static const char *rfmt1 = "%-10.10s %-17.17s %-5.5s %s%-3u %-9.9s %-15.15s %-.19s%s";
static const char *rfmt1r = "%s,%s,%s,%s%u,%s,%s,%s%s";
static const char *hdr2 =
-"Login Port What When From Location";
-static const char *rfmt2 = "%-10.10s %s%-5u %-6.6s %-13.13s %-10.10s %-.28s%s";
+"Login Port What When From Location";
+static const char *rfmt2 = "%-10.10s %s%-5u %-6.6s %-13.13s %-15.15s %-.28s%s";
static const char *rfmt2r = "%s,%s%u,%s,%s,%s,%s%s";
static const char *eol = "\n";
const char *radlog_dir = NULL;
const char *radutmp_file = NULL;
-const char *radius_dir = NULL;
+char *radius_dir = NULL;
const char *radacct_dir = NULL;
const char *radlib_dir = NULL;
uint32_t myip = INADDR_ANY;
* Global, for log.c to use.
*/
struct main_config_t mainconfig;
+char *request_log_file = NULL;
+char *debug_log_file = NULL;
+int radius_xlat(char *out, UNUSED int outlen, UNUSED const char *fmt,
+ UNUSED REQUEST *request, UNUSED RADIUS_ESCAPE_STRING func)
+{
+ *out = 0;
+ return 0;
+}
struct radutmp_config_t {
char *radutmp_fn;
/*
* Print a file from FINGER_DIR. If the file is executable,
- * execute it instead. Return 0 if succesfull.
+ * execute it instead. Return 0 if successful.
*/
static int ffile(const char *arg)
{
*/
static char *fullname(char *username)
{
+#ifdef HAVE_PWD_Hx
struct passwd *pwd;
char *s;
if ((s = strchr(pwd->pw_gecos, ',')) != NULL) *s = 0;
return pwd->pw_gecos;
}
+#endif
+
return username;
}
char *s = ctime(&t);
if (showname) {
- strlcpy(s + 4, s + 11, 5);
+ strlcpy(s + 4, s + 11, 6);
s[9] = 0;
} else {
- strlcpy(s + 4, s + 8, 8);
+ strlcpy(s + 4, s + 8, 9);
s[12] = 0;
}
printf("Acct-Delay-Time = 0\n");
exit(0); /* don't bother printing anything else */
}
-
+
/*
* Initialize mainconfig
*/
if (nas_ip_address != INADDR_NONE) {
if (rt.nas_address != nas_ip_address) continue;
}
-
+
memcpy(session_id, rt.session_id, sizeof(rt.session_id));
session_id[sizeof(rt.session_id)] = 0;
-
+
if (!rawoutput && rt.nas_port > (showname ? 999 : 99999)) {
portind = ">";
portno = (showname ? 999 : 99999);
memcpy(nasname, rt.login, sizeof(rt.login));
nasname[sizeof(rt.login)] = '\0';
- librad_safeprint(nasname, -1, buffer,
+ fr_print_string(nasname, 0, buffer,
sizeof(buffer));
printf("User-Name = \"%s\"\n", buffer);
- librad_safeprint(session_id, -1, buffer,
+ fr_print_string(session_id, 0, buffer,
sizeof(buffer));
printf("Acct-Session-Id = \"%s\"\n", buffer);
hostname(buffer, sizeof(buffer),
rt.framed_address));
}
-
+
/*
* Some sanity checks on the time
*/
memcpy(nasname, rt.caller_id,
sizeof(rt.caller_id));
nasname[sizeof(rt.caller_id)] = '\0';
-
- librad_safeprint(nasname, -1, buffer,
+
+ fr_print_string(nasname, 0, buffer,
sizeof(buffer));
printf("Calling-Station-Id = \"%s\"\n", buffer);
}