From d0df9cd33768b02cf5327c9d625568d21ced0297 Mon Sep 17 00:00:00 2001 From: Michael R Sweet Date: Wed, 1 Nov 2017 12:15:35 -0400 Subject: Update lpadmin documentation and show a meaningful error message for interface scripts (Issue #5111) --- systemv/lpadmin.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'systemv') diff --git a/systemv/lpadmin.c b/systemv/lpadmin.c index c608c2d30..b36ea48c4 100644 --- a/systemv/lpadmin.c +++ b/systemv/lpadmin.c @@ -1,7 +1,7 @@ /* * "lpadmin" command for CUPS. * - * Copyright 2007-2016 by Apple Inc. + * Copyright 2007-2017 by Apple Inc. * Copyright 1997-2006 by Easy Software Products. * * These coded instructions, statements, and computer programs are the @@ -218,6 +218,25 @@ main(int argc, /* I - Number of command-line arguments */ file = argv[i]; } + + if (*opt == 'i') + { + /* + * Check to see that the specified file is, in fact, a PPD... + */ + + cups_file_t *fp = cupsFileOpen(file, "r"); + char line[256]; + + if (!cupsFileGets(fp, line, sizeof(line)) || strncmp(line, "*PPD-Adobe", 10)) + { + _cupsLangPuts(stderr, _("lpadmin: System V interface scripts are no longer supported for security reasons.")); + cupsFileClose(fp); + return (1); + } + + cupsFileClose(fp); + } break; case 'E' : /* Enable the printer/enable encryption */ -- cgit v1.2.1