AC_ARG_ENABLE([snapped_cupsd], AS_HELP_STRING([--enable-snapped-cupsd], [enable support for packaging CUPS in a Snap]))
AC_ARG_ENABLE([snapped_clients], AS_HELP_STRING([--enable-snapped-clients], [enable support for CUPS controlling admin access from snapped clients]))
+AC_ARG_WITH([our-snap-name], AS_HELP_STRING([--with-our-snap-name], [Set name of the Snap we are snapped in, only needed with --enable-snapped-cupsd, default=cups]), [
+ OUR_SNAP_NAME="$withval"
+], [
+ OUR_SNAP_NAME="cups"
+])
+AC_DEFINE_UNQUOTED([OUR_SNAP_NAME], ["$OUR_SNAP_NAME"], [Name of the Snap we are snapped in.])
AC_ARG_WITH([snapctl], AS_HELP_STRING([--with-snapctl], [Set path for snapctl, only needed with --enable-snapped-cupsd, default=/usr/bin/snapctl]), [
SNAPCTL="$withval"
], [
#undef HAVE_SNAPDGLIB
#undef HAVE_SNAPD_CLIENT_RUN_SNAPCTL2_SYNC
#undef HAVE_SNAPCTL_IS_CONNECTED
+#undef OUR_SNAP_NAME
#undef SNAPCTL
#undef CUPS_CONTROL_SLOT
#undef SUPPORT_SNAPPED_CUPSD
} else
cupsdLogMessage(CUPSD_LOG_DEBUG, "cupsdCheckAdminTask: AppArmor profile of client process: %s", context);
+# ifdef OUR_SNAP_NAME
+ /* Is the client one of the utilities of our Snap? */
+ if (!strncmp(context, "snap." OUR_SNAP_NAME ".", strlen(OUR_SNAP_NAME) + 6))
+ {
+ cupsdLogMessage(CUPSD_LOG_DEBUG, "cupsdCheckAdminTask: Client Snap is the same Snap we are running in, access granted");
+ goto snap_check_done;
+ }
+# endif /* OUR_SNAP_NAME */
+
# ifdef SUPPORT_SNAPPED_CUPSD
/*