Skip to content

Commit

Permalink
Bring back custom icon option, GitHub #1622
Browse files Browse the repository at this point in the history
  • Loading branch information
rdmark committed Oct 13, 2024
1 parent e5ce743 commit 37f25d1
Show file tree
Hide file tree
Showing 4 changed files with 113 additions and 33 deletions.
134 changes: 102 additions & 32 deletions etc/afpd/icon.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,39 +8,109 @@

#include <atalk/globals.h>

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, 0xE1, 0xE1, 0x80, 0x0B, 0xD1, 0xE1,
0xC0, 0x0A, 0xC0, 0xE1, 0x70, 0x0B, 0x78, 0xC1,
0x1C, 0x0B, 0x79, 0xC1, 0x17, 0x0B, 0x33, 0xFF,
0x21, 0xCB, 0xFF, 0xC4, 0x40, 0x7F, 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 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
9 changes: 8 additions & 1 deletion etc/afpd/status.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
1 change: 1 addition & 0 deletions include/atalk/globals.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions libatalk/util/netatalk_conf.c
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit 37f25d1

Please sign in to comment.