]> arthur.barton.de Git - netatalk.git/commitdiff
New option -mimicmodel. From Timm Okke
authorFrank Lahm <franklahm@googlemail.com>
Wed, 1 Jun 2011 11:34:09 +0000 (13:34 +0200)
committerFrank Lahm <franklahm@googlemail.com>
Wed, 1 Jun 2011 11:34:09 +0000 (13:34 +0200)
NEWS
config/afpd.conf.tmpl
etc/afpd/afp_avahi.c
etc/afpd/afp_avahi.h
etc/afpd/afp_options.c
etc/afpd/globals.h
man/man5/afpd.conf.5.tmpl

diff --git a/NEWS b/NEWS
index 36fb0e14d8460da76a85de6314dc336f4341fccd..2ede1251bdece384885504078042cdc53c58424d 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,4 +1,5 @@
 * NEW: afpd: FCE event notifications
+* NEW: afpd: new option "-mimicmodel" for specifying Bonjour model registration
 
 Changes in 2.2beta4
 ===================
index 0994a116d4821f1f2475fac5ccd889e1451e20db..04ba0ca6b71290a25bb27482e536c647637541e5 100644 (file)
 #                               in dotted-decimal format for IPv4 or in
 #                               hexadecimal format for IPv6.
 #
+#   Avahi (Bonjour) related options:
+#     -mimicmodel <model>
+#                               Specifies the icon model that appears on
+#                               clients. Defaults to off. Examples: RackMac
+#                               (same as Xserve), PowerBook, PowerMac, Macmini,
+#                               iMac, MacBook, MacBookPro, MacBookAir, MacPro,
+#                               AppleTV1,1, AirPort
+#
 
 
 #
index a06c7be4237209e35faa9a4bee6f16da6ff01d00..dbd0cf2e75fd266f8e328b6df485ad4986a7ff29 100644 (file)
@@ -48,6 +48,7 @@ static void register_stuff(void) {
     DSI *dsi;
     char name[MAXINSTANCENAMELEN+1];
     AvahiStringList *strlist = NULL;
+    AvahiStringList *strlist2 = NULL;
     char tmpname[256];
 
     assert(ctx->client);
@@ -143,6 +144,25 @@ static void register_stuff(void) {
                     avahi_strerror(avahi_client_errno(ctx->client)));
                 goto fail;
             }  /* if */
+
+            if (config->obj.options.mimicmodel) {
+                strlist2 = avahi_string_list_add_printf(strlist2, "model=%s", config->obj.options.mimicmodel);
+                if (avahi_entry_group_add_service_strlst(ctx->group,
+                                                         AVAHI_IF_UNSPEC,
+                                                         AVAHI_PROTO_UNSPEC,
+                                                         0,
+                                                         dsi->bonjourname,
+                                                         DEV_INFO_SERVICE_TYPE,
+                                                         NULL,
+                                                         NULL,
+                                                         0,
+                                                         strlist2) < 0) {
+                    LOG(log_error, logtype_afpd, "Failed to add service: %s",
+                        avahi_strerror(avahi_client_errno(ctx->client)));
+                    goto fail;
+                }
+            } /* if (config->obj.options.mimicmodel) */
+
         }      /* for config*/
 
         if (avahi_entry_group_commit(ctx->group) < 0) {
index 2c6ca706d0e5176e1bf8d82eb12b2154d02d9480..c0216fef4723f7d0b722c2a1d7b89bc7634105fb 100644 (file)
@@ -26,6 +26,7 @@
 
 #define AFP_DNS_SERVICE_TYPE "_afpovertcp._tcp"
 #define ADISK_SERVICE_TYPE "_adisk._tcp"
+#define DEV_INFO_SERVICE_TYPE "_device-info._tcp"
 
 #define MAXINSTANCENAMELEN 63
 
index 82db1c8e5bae81acf233e733b5fe96f8b96d719a..3ad83fe26d19d1b872ef05b7bf78413ed82aa02b 100644 (file)
@@ -140,6 +140,8 @@ void afp_options_free(struct afp_options *opt,
        free(opt->ntseparator);
     if (opt->logconfig && (opt->logconfig != save->logconfig))
        free(opt->logconfig);
+       if (opt->mimicmodel && (opt->mimicmodel != save->mimicmodel))
+       free(opt->mimicmodel);
 }
 
 /* initialize options */
@@ -190,6 +192,7 @@ void afp_options_init(struct afp_options *options)
     options->tcp_sndbuf = 0;    /* 0 means don't change OS default */
     options->tcp_rcvbuf = 0;    /* 0 means don't change OS default */
     options->dsireadbuf = 12;
+       options->mimicmodel = NULL;
 }
 
 /* parse an afpd.conf line. i'm doing it this way because it's
@@ -492,6 +495,9 @@ int afp_options_parseline(char *buf, struct afp_options *options)
                fce_set_events(c);
        }
 
+    if ((c = getoption(buf, "-mimicmodel")) && (opt = strdup(c)))
+       options->mimicmodel = opt;
+
     return 1;
 }
 
index 02dcf8b56b58abd1dd00d02dbe44452a2c19a3e4..cca15f575ace63d295d9b7755584f7cef52845a5 100644 (file)
@@ -96,6 +96,8 @@ struct afp_options {
     /* default value for winbind authentication */
     char *ntdomain, *ntseparator;
     char *logconfig;
+
+    char *mimicmodel;
 };
 
 #define AFPOBJ_TMPSIZ (MAXPATHLEN)
index a6c29e61162b03f8f96e6e223df5b028e26ccf63..eb68d49a67ed34e243b02a2ec61f7b5198a02e16 100644 (file)
@@ -422,6 +422,11 @@ Sets a message to be displayed when clients logon to the server\&. The message s
 and should be quoted\&. Extended characters are allowed\&.
 .RE
 .PP
+\-mimicmodel \fImodel\fR
+.RS 4
+Specifies the icon model that appears on clients\&. Defaults to off\&. Examples: RackMac (same as Xserve), PowerBook, PowerMac, Macmini, iMac, MacBook, MacBookPro, MacBookAir, MacPro, AppleTV1,1, AirPort\&.
+.RE
+.PP
 \-nodebug
 .RS 4
 Disables debugging\&.