From 37f25d107f47e1e13bb8c65c54f8dfdc01196a15 Mon Sep 17 00:00:00 2001 From: Daniel Markstedt Date: Sun, 13 Oct 2024 12:49:39 +0200 Subject: [PATCH] Bring back custom icon option, GitHub #1622 --- etc/afpd/icon.h | 134 ++++++++++++++++++++++++++-------- etc/afpd/status.c | 9 ++- include/atalk/globals.h | 1 + libatalk/util/netatalk_conf.c | 2 + 4 files changed, 113 insertions(+), 33 deletions(-) diff --git a/etc/afpd/icon.h b/etc/afpd/icon.h index 8d3bc9361f..2d532433b4 100644 --- a/etc/afpd/icon.h +++ b/etc/afpd/icon.h @@ -8,39 +8,109 @@ #include +static const unsigned char apple_atalk_icon[] = { /* default appletalk icon */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x9F, 0xE0, + 0x00, 0x04, 0x50, 0x30, 0x00, 0x08, 0x30, 0x28, + 0x00, 0x10, 0x10, 0x3C, 0x07, 0xA0, 0x08, 0x04, + 0x18, 0x7F, 0x04, 0x04, 0x10, 0x00, 0x82, 0x04, + 0x10, 0x00, 0x81, 0x04, 0x10, 0x00, 0x82, 0x04, + 0x10, 0x00, 0x84, 0x04, 0x10, 0x00, 0x88, 0x04, + 0x10, 0x00, 0x90, 0x04, 0x10, 0x00, 0xB0, 0x04, + 0x10, 0x00, 0xD0, 0x04, 0xFF, 0xFF, 0xFF, 0xFF, + 0x40, 0x00, 0x00, 0x02, 0x3F, 0xFF, 0xFF, 0xFC, + 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x05, 0x00, + 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, + 0x00, 0x00, 0x0F, 0x80, 0x00, 0x00, 0x08, 0x80, + 0x00, 0x00, 0x08, 0x80, 0x00, 0x00, 0x0F, 0x80, + 0x00, 0x00, 0x0A, 0x80, 0xBF, 0xFF, 0xF2, 0x74, + 0x00, 0x00, 0x05, 0x00, 0xBF, 0xFF, 0xF8, 0xF4, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x9F, 0xE0, + 0x00, 0x07, 0xDF, 0xF0, 0x00, 0x0F, 0xFF, 0xF8, + 0x00, 0x1F, 0xFF, 0xFC, 0x07, 0xBF, 0xFF, 0xFC, + 0x1F, 0xFF, 0xFF, 0xFC, 0x1F, 0xFF, 0xFF, 0xFC, + 0x1F, 0xFF, 0xFF, 0xFC, 0x1F, 0xFF, 0xFF, 0xFC, + 0x1F, 0xFF, 0xFF, 0xFC, 0x1F, 0xFF, 0xFF, 0xFC, + 0x1F, 0xFF, 0xFF, 0xFC, 0x1F, 0xFF, 0xFF, 0xFC, + 0x1F, 0xFF, 0xFF, 0xFC, 0xFF, 0xFF, 0xFF, 0xFF, + 0x7F, 0xFF, 0xFF, 0xFE, 0x3F, 0xFF, 0xFF, 0xFC, + 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, + 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, + 0x00, 0x00, 0x0F, 0x80, 0x00, 0x00, 0x0F, 0x80, + 0x00, 0x00, 0x0F, 0x80, 0x00, 0x00, 0x0F, 0x80, + 0x00, 0x00, 0x0F, 0x80, 0xBF, 0xFF, 0xFF, 0xF4, + 0xBF, 0xFF, 0xFD, 0xF4, 0xBF, 0xFF, 0xF8, 0xF4 +}; + +static const unsigned char apple_tcp_icon[] = { /* default asip icon */ + 0x30, 0x00, 0x8F, 0xF8, 0xCC, 0x01, 0x48, 0x0C, + 0xB3, 0x32, 0x28, 0x0A, 0x8C, 0xCC, 0x7C, 0x0F, + 0x83, 0x02, 0xFF, 0x01, 0x80, 0xC3, 0xC3, 0x81, + 0x80, 0x33, 0xE3, 0xC1, 0x80, 0x0B, 0xD3, 0xC1, + 0x80, 0x0B, 0xB1, 0x61, 0x80, 0x0B, 0xE0, 0xE1, + 0x80, 0x0B,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03, 0x80, 0x00, 0x00, 0x03, 0x80, 0x00, + 0x00, 0x07, 0xC0, 0x00, 0x00, 0x07, 0xC0, 0x00, + 0x00, 0x07, 0xC0, 0x00, 0x00, 0x07, 0xC0, 0x00, + 0x00, 0x07, 0xC0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, + 0x3F, 0xFE, 0xFF, 0xFF, 0xFF, 0xFC, 0x7F, 0xFF +}; + static const unsigned char icon[] = { /* daemon */ - 0x0, 0x0, 0x0, 0x0, 0x0, 0x80, 0x2, 0x0, - 0x1, 0x80, 0x3, 0x0, 0x2, 0x80, 0x2, 0x80, - 0x2, 0x80, 0x2, 0x80, 0x4, 0x80, 0x2, 0x40, - 0x4, 0x87, 0xC2, 0x40, 0x4, 0x58, 0x34, 0x40, - 0x4, 0x20, 0x8, 0x40, 0x2, 0x16, 0xD0, 0x80, - 0x1, 0x1, 0x1, 0x0, 0x2, 0x80, 0x2, 0x80, - 0x2, 0x9C, 0x72, 0x80, 0x4, 0x22, 0x88, 0x40, - 0x4, 0x41, 0x4, 0x40, 0x4, 0x41, 0x4, 0x40, - 0x4, 0x41, 0x4, 0x40, 0x4, 0x49, 0x24, 0x40, - 0xE, 0x55, 0x54, 0xE0, 0x10, 0x5D, 0x74, 0x10, - 0x10, 0x3E, 0xF8, 0x10, 0x7F, 0xFC, 0x7F, 0xFE, - 0x20, 0x4, 0x40, 0x4, 0x1F, 0xFC, 0x7F, 0xF8, - 0x0, 0x7, 0xC0, 0x0, 0x0, 0x4, 0x40, 0x0, - 0x0, 0x3, 0x80, 0x0, 0x0, 0x4, 0x40, 0x0, - 0xAF, 0xF9, 0x3F, 0xF5, 0x0, 0x2, 0x80, 0x0, - 0xAF, 0xFC, 0x7F, 0xF5, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x80, 0x2, 0x0, - 0x1, 0x80, 0x3, 0x0, 0x3, 0x80, 0x3, 0x80, - 0x3, 0x80, 0x3, 0x80, 0x7, 0x80, 0x3, 0xC0, - 0x7, 0x87, 0xC3, 0xC0, 0x7, 0xDF, 0xF7, 0xC0, - 0x7, 0xFF, 0xFF, 0xC0, 0x3, 0xFF, 0xFF, 0x80, - 0x1, 0xFF, 0xFF, 0x0, 0x3, 0xFF, 0xFF, 0x80, - 0x3, 0xFF, 0xFF, 0x80, 0x7, 0xFF, 0xFF, 0xC0, - 0x7, 0xFF, 0xFF, 0xC0, 0x7, 0xFF, 0xFF, 0xC0, - 0x7, 0xFF, 0xFF, 0xC0, 0x7, 0xFF, 0xFF, 0xC0, - 0xF, 0xFF, 0xFF, 0xE0, 0x1F, 0xFF, 0xFF, 0xF0, - 0x1F, 0xFF, 0xFF, 0xF0, 0x7F, 0xFF, 0xFF, 0xFE, - 0x3F, 0xFF, 0xFF, 0xFC, 0x1F, 0xFF, 0xFF, 0xF8, - 0x0, 0x7, 0xC0, 0x0, 0x0, 0x7, 0xC0, 0x0, - 0x0, 0x3, 0x80, 0x0, 0x0, 0x4, 0x40, 0x0, - 0xAF, 0xF9, 0x3F, 0xF5, 0x0, 0x2, 0x80, 0x0, - 0xAF, 0xFC, 0x7F, 0xF5, 0x0, 0x0, 0x0, 0x0 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x02, 0x00, + 0x01, 0x80, 0x03, 0x00, 0x02, 0x80, 0x02, 0x80, + 0x02, 0x80, 0x02, 0x80, 0x04, 0x80, 0x02, 0x40, + 0x04, 0x87, 0xC2, 0x40, 0x04, 0x58, 0x34, 0x40, + 0x04, 0x20, 0x08, 0x40, 0x02, 0x16, 0xD0, 0x80, + 0x01, 0x01, 0x01, 0x00, 0x02, 0x80, 0x02, 0x80, + 0x02, 0x9C, 0x72, 0x80, 0x04, 0x22, 0x88, 0x40, + 0x04, 0x41, 0x04, 0x40, 0x04, 0x41, 0x04, 0x40, + 0x04, 0x41, 0x04, 0x40, 0x04, 0x49, 0x24, 0x40, + 0x0E, 0x55, 0x54, 0xE0, 0x10, 0x5D, 0x74, 0x10, + 0x10, 0x3E, 0xF8, 0x10, 0x7F, 0xFC, 0x7F, 0xFE, + 0x20, 0x04, 0x40, 0x04, 0x1F, 0xFC, 0x7F, 0xF8, + 0x00, 0x07, 0xC0, 0x00, 0x00, 0x04, 0x40, 0x00, + 0x00, 0x03, 0x80, 0x00, 0x00, 0x04, 0x40, 0x00, + 0xAF, 0xF9, 0x3F, 0xF5, 0x00, 0x02, 0x80, 0x00, + 0xAF, 0xFC, 0x7F, 0xF5, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x02, 0x00, + 0x01, 0x80, 0x03, 0x00, 0x03, 0x80, 0x03, 0x80, + 0x03, 0x80, 0x03, 0x80, 0x07, 0x80, 0x03, 0xC0, + 0x07, 0x87, 0xC3, 0xC0, 0x07, 0xDF, 0xF7, 0xC0, + 0x07, 0xFF, 0xFF, 0xC0, 0x03, 0xFF, 0xFF, 0x80, + 0x01, 0xFF, 0xFF, 0x00, 0x03, 0xFF, 0xFF, 0x80, + 0x03, 0xFF, 0xFF, 0x80, 0x07, 0xFF, 0xFF, 0xC0, + 0x07, 0xFF, 0xFF, 0xC0, 0x07, 0xFF, 0xFF, 0xC0, + 0x07, 0xFF, 0xFF, 0xC0, 0x07, 0xFF, 0xFF, 0xC0, + 0x0F, 0xFF, 0xFF, 0xE0, 0x1F, 0xFF, 0xFF, 0xF0, + 0x1F, 0xFF, 0xFF, 0xF0, 0x7F, 0xFF, 0xFF, 0xFE, + 0x3F, 0xFF, 0xFF, 0xFC, 0x1F, 0xFF, 0xFF, 0xF8, + 0x00, 0x07, 0xC0, 0x00, 0x00, 0x07, 0xC0, 0x00, + 0x00, 0x03, 0x80, 0x00, 0x00, 0x04, 0x40, 0x00, + 0xAF, 0xF9, 0x3F, 0xF5, 0x00, 0x02, 0x80, 0x00, + 0xAF, 0xFC, 0x7F, 0xF5, 0x00, 0x00, 0x00, 0x00 }; #endif diff --git a/etc/afpd/status.c b/etc/afpd/status.c index 0e0b528d3f..dd4c7a2b1e 100644 --- a/etc/afpd/status.c +++ b/etc/afpd/status.c @@ -493,7 +493,14 @@ void status_init(AFPObj *dsi_obj, AFPObj* asp_obj, DSI *dsi) #endif dsi); status_uams(status, options->uamlist); - status_icon(status, icon, sizeof(icon), c); + if (options->flags & OPTION_CUSTOMICON) + status_icon(status, icon, sizeof(icon), c); +#ifndef NO_DDP + else if (asp) + status_icon(status, apple_atalk_icon, sizeof(apple_atalk_icon), c); +#endif + else + status_icon(status, apple_tcp_icon, sizeof(apple_tcp_icon), c); sigoff = status_signature(status, &c, options); /* c now contains the offset where the netaddress offset lives */ diff --git a/include/atalk/globals.h b/include/atalk/globals.h index 56a7399209..b15ea4aac8 100644 --- a/include/atalk/globals.h +++ b/include/atalk/globals.h @@ -66,6 +66,7 @@ #define OPTION_RECVFILE (1 << 15) #define OPTION_SPOTLIGHT_EXPR (1 << 16) /* whether to allow Spotlight logic expressions */ #define OPTION_DDP (1 << 17) /* whether to allow connections via appletalk/ddp */ +#define OPTION_CUSTOMICON (1 << 18) #define PASSWD_NONE 0 #define PASSWD_SET (1 << 0) diff --git a/libatalk/util/netatalk_conf.c b/libatalk/util/netatalk_conf.c index 6bcccfa84d..dc9e3ac0e6 100644 --- a/libatalk/util/netatalk_conf.c +++ b/libatalk/util/netatalk_conf.c @@ -2082,6 +2082,8 @@ int afp_config_parse(AFPObj *AFPObj, char *processname) /* "server options" boolean options */ if (!atalk_iniparser_getboolean(config, INISEC_GLOBAL, "zeroconf", 1)) options->flags |= OPTION_NOZEROCONF; + if (atalk_iniparser_getboolean(config, INISEC_GLOBAL, "custom icon", 0)) + options->flags |= OPTION_CUSTOMICON; if (atalk_iniparser_getboolean(config, INISEC_GLOBAL, "advertise ssh", 0)) options->flags |= OPTION_ANNOUNCESSH; if (atalk_iniparser_getboolean(config, INISEC_GLOBAL, "close vol", 0))