diff options
author | Michael R Sweet <michael.r.sweet@gmail.com> | 2018-12-06 14:58:01 -0500 |
---|---|---|
committer | Michael R Sweet <michael.r.sweet@gmail.com> | 2018-12-06 14:58:01 -0500 |
commit | f1def5b85f51120f5dc1eb21e1f38860ef41be9c (patch) | |
tree | 6f03cf6c4a8bb87340be5cf73687710032dd361e /systemv | |
parent | dc5c941a67f25ec19fc1ab97e4b0ee849fb3ed63 (diff) | |
download | cups-f1def5b85f51120f5dc1eb21e1f38860ef41be9c.tar.gz |
Remove cupsaddsmb and associated documentation and infrastructure (Issue #5449)
Diffstat (limited to 'systemv')
-rw-r--r-- | systemv/Makefile | 16 | ||||
-rw-r--r-- | systemv/cupsaddsmb.c | 282 |
2 files changed, 2 insertions, 296 deletions
diff --git a/systemv/Makefile b/systemv/Makefile index ead90f78a..a205ed3ba 100644 --- a/systemv/Makefile +++ b/systemv/Makefile @@ -10,9 +10,9 @@ include ../Makedefs -TARGETS = cancel cupsaccept cupsaddsmb cupsctl cupstestppd \ +TARGETS = cancel cupsaccept cupsctl cupstestppd \ lp lpadmin lpinfo lpmove lpoptions lpstat -OBJS = cancel.o cupsaccept.o cupsaddsmb.o cupsctl.o \ +OBJS = cancel.o cupsaccept.o cupsctl.o \ cupstestppd.o lp.o lpadmin.o lpinfo.o lpmove.o lpoptions.o \ lpstat.o @@ -77,7 +77,6 @@ install-exec: echo Installing System V admin printing commands in $(SBINDIR) $(INSTALL_DIR) -m 755 $(SBINDIR) $(INSTALL_BIN) cupsaccept $(SBINDIR) - $(INSTALL_BIN) cupsaddsmb $(SBINDIR) $(INSTALL_BIN) cupsctl $(SBINDIR) $(INSTALL_BIN) lpadmin $(SBINDIR) $(INSTALL_BIN) lpinfo $(SBINDIR) @@ -135,7 +134,6 @@ uninstall: -$(RMDIR) $(BINDIR) $(RM) $(SBINDIR)/accept $(RM) $(SBINDIR)/cupsaccept - $(RM) $(SBINDIR)/cupsaddsmb $(RM) $(SBINDIR)/cupsaccept $(RM) $(SBINDIR)/cupsdisable $(RM) $(SBINDIR)/cupsenable @@ -172,16 +170,6 @@ cupsaccept: cupsaccept.o ../cups/$(LIBCUPS) # -# cupsaddsmb -# - -cupsaddsmb: cupsaddsmb.o ../cups/$(LIBCUPS) - echo Linking $@... - $(LD_CC) $(LDFLAGS) -o cupsaddsmb cupsaddsmb.o $(LIBS) - $(CODE_SIGN) -s "$(CODE_SIGN_IDENTITY)" $@ - - -# # cupsctl # diff --git a/systemv/cupsaddsmb.c b/systemv/cupsaddsmb.c deleted file mode 100644 index d1f9ac287..000000000 --- a/systemv/cupsaddsmb.c +++ /dev/null @@ -1,282 +0,0 @@ -/* - * "cupsaddsmb" command for CUPS. - * - * Copyright 2007-2012 by Apple Inc. - * Copyright 2001-2006 by Easy Software Products. - * - * Licensed under Apache License v2.0. See the file "LICENSE" for more information. - */ - -/* - * Include necessary headers... - */ - -#include <cups/cups-private.h> -#include <cups/adminutil.h> -#include <fcntl.h> -#include <unistd.h> -#include <sys/wait.h> - - -/* - * Local globals... - */ - -int Verbosity = 0; -const char *SAMBAUser, - *SAMBAPassword, - *SAMBAServer; - - -/* - * Local functions... - */ - -int export_dest(http_t *http, const char *dest); -void usage(void) _CUPS_NORETURN; - - -/* - * 'main()' - Export printers on the command-line. - */ - -int /* O - Exit status */ -main(int argc, /* I - Number of command-line arguments */ - char *argv[]) /* I - Command-line arguments */ -{ - int i, j; /* Looping vars */ - int status; /* Status from export_dest() */ - int export_all; /* Export all printers? */ - http_t *http; /* Connection to server */ - int num_dests; /* Number of printers */ - cups_dest_t *dests; /* Printers */ - - - _cupsSetLocale(argv); - - /* - * Parse command-line arguments... - */ - - export_all = 0; - http = NULL; - SAMBAUser = cupsUser(); - SAMBAPassword = NULL; - SAMBAServer = NULL; - - for (i = 1; i < argc; i ++) - if (!strcmp(argv[i], "-E")) - { -#ifdef HAVE_SSL - cupsSetEncryption(HTTP_ENCRYPT_REQUIRED); -#else - _cupsLangPrintf(stderr, - _("%s: Sorry, no encryption support."), - argv[0]); -#endif /* HAVE_SSL */ - } - else if (!strcmp(argv[i], "-H")) - { - i ++; - if (i >= argc) - usage(); - - SAMBAServer = argv[i]; - } - else if (!strcmp(argv[i], "-U")) - { - char *sep; /* Separator for password */ - - - i ++; - if (i >= argc) - usage(); - - SAMBAUser = argv[i]; - - if ((sep = strchr(argv[i], '%')) != NULL) - { - /* - * Nul-terminate the username at the first % and point the - * password at the rest... - */ - - *sep++ = '\0'; - - SAMBAPassword = sep; - } - } - else if (!strcmp(argv[i], "-a")) - export_all = 1; - else if (!strcmp(argv[i], "-h")) - { - i ++; - if (i >= argc) - usage(); - - cupsSetServer(argv[i]); - } - else if (!strcmp(argv[i], "-v")) - Verbosity = 1; - else if (argv[i][0] != '-') - { - if (!http) - { - /* - * Connect to the server... - */ - - if ((http = httpConnectEncrypt(cupsServer(), ippPort(), - cupsEncryption())) == NULL) - { - _cupsLangPrintf(stderr, _("%s: Unable to connect to server."), - argv[0]); - exit(1); - } - } - - if (SAMBAServer == NULL) - { - SAMBAServer = cupsServer(); - - if (SAMBAServer[0] == '/') /* Use localhost instead of domain socket */ - SAMBAServer = "localhost"; - } - - if ((status = export_dest(http, argv[i])) != 0) - return (status); - } - else - usage(); - - /* - * Connect to the server... - */ - - if ((http = httpConnectEncrypt(cupsServer(), ippPort(), - cupsEncryption())) == NULL) - { - _cupsLangPrintf(stderr, _("%s: Unable to connect to server."), argv[0]); - exit(1); - } - - /* - * See if the user specified "-a"... - */ - - if (export_all) - { - /* - * Export all printers... - */ - - if (SAMBAServer == NULL) - { - SAMBAServer = cupsServer(); - - if (SAMBAServer[0] == '/') /* Use localhost instead of domain socket */ - SAMBAServer = "localhost"; - } - - num_dests = cupsGetDests2(http, &dests); - - for (j = 0, status = 0; j < num_dests; j ++) - if (!dests[j].instance) - { - if ((status = export_dest(http, dests[j].name)) != 0) - break; - } - - cupsFreeDests(num_dests, dests); - - if (status) - return (status); - } - - return (0); -} - - -/* - * 'export_dest()' - Export a destination to SAMBA. - */ - -int /* O - 0 on success, non-zero on error */ -export_dest(http_t *http, /* I - Connection to server */ - const char *dest) /* I - Destination to export */ -{ - int status; /* Status of export */ - char ppdfile[1024], /* PPD file for printer drivers */ - prompt[1024]; /* Password prompt */ - int tries; /* Number of tries */ - - - /* - * Get the Windows PPD file for the printer... - */ - - if (!cupsAdminCreateWindowsPPD(http, dest, ppdfile, sizeof(ppdfile))) - { - _cupsLangPrintf(stderr, - _("cupsaddsmb: No PPD file for printer \"%s\" - %s"), - dest, cupsLastErrorString()); - return (1); - } - - /* - * Try to export it... - */ - - for (status = 0, tries = 0; !status && tries < 3; tries ++) - { - /* - * Get the password, as needed... - */ - - if (!SAMBAPassword) - { - snprintf(prompt, sizeof(prompt), - _cupsLangString(cupsLangDefault(), - _("Password for %s required to access %s via " - "SAMBA: ")), - SAMBAUser, SAMBAServer); - - if ((SAMBAPassword = cupsGetPassword(prompt)) == NULL) - break; - } - - status = cupsAdminExportSamba(dest, ppdfile, SAMBAServer, - SAMBAUser, SAMBAPassword, - Verbosity ? stderr : NULL); - - if (!status && cupsLastError() == IPP_NOT_FOUND) - break; - } - - unlink(ppdfile); - - return (!status); -} - - -/* - * 'usage()' - Show program usage and exit... - */ - -void -usage(void) -{ - _cupsLangPuts(stdout, _("Usage: cupsaddsmb [options] printer1 ... printerN")); - _cupsLangPuts(stdout, _(" cupsaddsmb [options] -a")); - _cupsLangPuts(stdout, ""); - _cupsLangPuts(stdout, _("Options:")); - _cupsLangPuts(stdout, _(" -E Encrypt the connection.")); - _cupsLangPuts(stdout, _(" -H samba-server Use the named SAMBA " - "server.")); - _cupsLangPuts(stdout, _(" -U username Specify username.")); - _cupsLangPuts(stdout, _(" -a Export all printers.")); - _cupsLangPuts(stdout, _(" -h server[:port] Specify server address.")); - _cupsLangPuts(stdout, _(" -v Be verbose.")); - - exit(1); -} |