Commit 42862c21 authored by Didier 'OdyX' Raboud's avatar Didier 'OdyX' Raboud

Imported Upstream version 3.16.2

parent d1298c61

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.

......@@ -60,9 +60,14 @@ else
libsane_hpaio_la_LDFLAGS = -version-info 1:0:0
endif
# The following is a interlibrary dependency that must be compiled first.
libsane_hpaio_la_LIBADD = libhpip.la libhpdiscovery.la libhpmud.la libhpipp.la $(DBUS_LIBS) -lcups -ldl
libsane_hpaio_la_LIBADD = libhpip.la libhpmud.la libhpipp.la $(DBUS_LIBS) -lcups -ldl
#libsane_hpaio_la_CFLAGS = -DWITH_NONAMESPACES -DSOAP_DEBUG
libsane_hpaio_la_CFLAGS = $(DBUS_CFLAGS) -Iprotocol -Iprotocol/discovery
libsane_hpaio_la_CFLAGS = $(DBUS_CFLAGS) -Iprotocol
if NETWORK_BUILD
libsane_hpaio_la_LIBADD += libhpdiscovery.la
libsane_hpaio_la_CFLAGS += -Iprotocol/discovery
endif
endif # SCAN_BUILD
......@@ -75,12 +80,13 @@ libhpdiscovery_la_LDFLAGS = -version-info 0:1:0
libhpdiscovery_la_LIBADD = -l$(SNMPLIB) -lcrypto
endif
# hpmud library
MUDNAME=hpmud
lib_LTLIBRARIES += libhpmud.la
libhpmud_la_CFLAGS = -DMUDNAME=\"$(MUDNAME)\" -DCONFDIR=\"$(hplip_confdir)\" -Iprotocol -Iprotocol/discovery
libhpmud_la_CFLAGS = -DMUDNAME=\"$(MUDNAME)\" -DCONFDIR=\"$(hplip_confdir)\" -Iprotocol
libhpmud_la_LDFLAGS = -version-info 0:6:0 -lpthread -ldl
libhpmud_la_SOURCES = io/hpmud/hpmud.c io/hpmud/mlc.c io/hpmud/model.c io/hpmud/pml.c \
io/hpmud/hpmud.h io/hpmud/hpmudi.h io/hpmud/list.h io/hpmud/mlc.h io/hpmud/pml.h io/hpmud/dot4.c \
......@@ -97,6 +103,7 @@ libhpmud_la_LDFLAGS += -lusb-1.0
endif
if NETWORK_BUILD
libhpmud_la_CFLAGS += -Iprotocol/discovery
libhpmud_la_LDFLAGS += -l$(SNMPLIB) -lcrypto
libhpmud_la_LIBADD = libhpdiscovery.la
endif
......@@ -310,8 +317,13 @@ hpmudextdir = $(pyexecdir)
hpmudext_LTLIBRARIES = hpmudext.la
hpmudext_la_LDFLAGS = -module -avoid-version
hpmudext_la_SOURCES = io/mudext/hpmudext.c
hpmudext_la_LIBADD = libhpmud.la libhpdiscovery.la
hpmudext_la_CFLAGS = -I$(PYTHONINCLUDEDIR) -Iprotocol/discovery
hpmudext_la_CFLAGS = -I$(PYTHONINCLUDEDIR)
hpmudext_la_LIBADD = libhpmud.la
if NETWORK_BUILD
hpmudext_la_LIBADD += libhpdiscovery.la
hpmudext_la_CFLAGS += -Iprotocol/discovery
endif
if !LIBUSB01_BUILD
hpmudext_la_CFLAGS +=-I/usr/include/libusb-1.0
......
This diff is collapsed.
......@@ -563,6 +563,8 @@ def probeDevices(bus=DEFAULT_PROBE_BUS, timeout=10,
devid = m.group(4) or ''
log.debug(uri)
if("scanjet" in mdl.lower()):
continue # Do not include HP Scanjets
try:
back_end, is_hp, bb, model, serial, dev_file, host, zc, port = \
......
......@@ -129,10 +129,14 @@ class ConfigBase(object):
fp = open(self.filename, "r")
try:
self.conf.readfp(fp)
except configparser.MissingSectionHeaderError:
print("")
log.error("Found No Section in %s. Please set the http proxy for root and try again." % self.filename)
except (configparser.DuplicateOptionError):
log.warn("Found Duplicate Entery in %s" % self.filename)
self.CheckDuplicateEntries()
fp.close()
finally:
fp.close()
except (OSError, IOError, configparser.MissingSectionHeaderError):
log.debug("Unable to open file %s for reading." % self.filename)
......
......@@ -104,6 +104,7 @@ def get_distro_name():
class Password(object):
def __init__(self, Mode = INTERACTIVE_MODE):
self.__password =""
self.__password_prompt_str=""
self.__passwordValidated = False
self.__mode = Mode
self.__readAuthType() #self.__authType
......@@ -200,8 +201,7 @@ class Password(object):
i = child.expect(self.__expectList)
cb = child.before
if cb:
if cb:
start = time.time()
output.write(cb)
......@@ -209,11 +209,26 @@ class Password(object):
ok, ret = True, output.getvalue()
break
elif i == 1: # TIMEOUT
elif i == 1: # TIMEOUT
if('true' in cmd and self.__password_prompt_str == ""): #sudo true or su -c "true"
cb = cb.replace("[", "\[")
cb = cb.replace("]", "\]")
self.__password_prompt_str = cb
try:
p = re.compile(cb, re.I)
except TypeError:
self.__expectList.append(cb)
else:
self.__expectList.append(p)
log.debug("Adding missing password prompt string [%s]"%self.__password_prompt_str)
continue
else: # password
if(self.__password_prompt_str == ""):
self.__password_prompt_str = utils.EXPECT_WORD_LIST[i]
log.debug("Updating password prompt string [%s]"%self.__password_prompt_str)
child.sendline(self.__password)
except (Exception, pexpect.ExceptionPexpect) as e:
......@@ -355,3 +370,7 @@ class Password(object):
self.__validatePassword( pswd_msg)
return self.__password
def getPasswordPromptString(self):
return self.__password_prompt_str
......@@ -107,23 +107,21 @@ ERROR_DIGITAL_SIGN_BAD =3
MAJ_VER = sys.version_info[0]
MIN_VER = sys.version_info[1]
EXPECT_WORD_LIST = [
pexpect.EOF, # 0
pexpect.TIMEOUT, # 1
"Continue?", # 2 (for zypper)
"passwor[dt]:", # en/de/it/ru
"kennwort", # de?
"password for", # en
"mot de passe", # fr
"contraseña", # es
"palavra passe", # pt
"口令", # zh
"wachtwoord", # nl
"heslo", # czech
"密码",
"Lösenord", #sv
u"Continue?", # 2 (for zypper)
u"passwor[dt]:", # en/de/it/ru
u"kennwort", # de?
u"password for", # en
u"mot de passe", # fr
u"contraseña", # es
u"palavra passe", # pt
u"口令", # zh
u"wachtwoord", # nl
u"heslo", # czech
u"密码",
u"Lösenord", #sv
]
......@@ -1260,6 +1258,17 @@ def run(cmd, passwordObj = None, pswd_msg='', log_output=True, spinner=True, tim
import io
output = io.StringIO()
pwd_prompt_str = ""
if passwordObj and ('su' in cmd or 'sudo' in cmd) and os.geteuid() != 0:
pwd_prompt_str = passwordObj.getPasswordPromptString()
log.debug("cmd = %s pwd_prompt_str = [%s]"%(cmd, pwd_prompt_str))
if(pwd_prompt_str == ""):
passwd = passwordObj.getPassword(pswd_msg, 0)
pwd_prompt_str = passwordObj.getPasswordPromptString()
log.debug("pwd_prompt_str2 = [%s]"%(pwd_prompt_str))
if(passwd == ""):
return 127, ""
try:
child = pexpect.spawnu(cmd, timeout=timeout)
except pexpect.ExceptionPexpect as e:
......@@ -1277,15 +1286,22 @@ def run(cmd, passwordObj = None, pswd_msg='', log_output=True, spinner=True, tim
continue
if child.before:
if(pwd_prompt_str and pwd_prompt_str not in EXPECT_LIST):
log.debug("Adding %s to EXPECT LIST"%pwd_prompt_str)
try:
p = re.compile(pwd_prompt_str, re.I)
except TypeError:
EXPECT_LIST.append(pwd_prompt_str)
else:
EXPECT_LIST.append(p)
EXPECT_LIST.append(pwd_prompt_str)
try:
output.write(child.before)
if log_output:
log.debug(child.before)
except Exception:
pass
if log_output:
try:
log.debug(child.before)
except Exception:
pass
if i == 0: # EOF
break
......@@ -2018,7 +2034,7 @@ def download_from_network(weburl, outputFile = None, useURLLIB=False):
if useURLLIB:
sys.stdout.write("Download in progress..........")
#sys.stdout.write("Download in progress..........")
try:
response = urllib2_request.urlopen(weburl)
file_fd = open(outputFile, 'wb')
......
......@@ -517,13 +517,13 @@ class DependenciesCheck(CoreInstall):
status, output = utils.run('lpstat -p%s' % printer_name)
log.info("Printer status: %s" % output.replace("\n", ""))
if back_end == 'hpfax' and not 'HP Fax' in desc:
if back_end == 'hpfax' and not 'HP Fax' in desc and desc != '':
self.num_errors += 1
log.error("Incorrect PPD file for fax queue '%s'. Fax queues must use 'HP-Fax-hplip.ppd'." % printer_name)
log.error("Incorrect PPD file for fax queue '%s'. Fax queues must use 'HP-Fax(n)-hpcups.ppd'." % printer_name)
elif back_end == 'hp' and 'HP Fax' in desc:
elif back_end == 'hp' and 'HP Fax' in desc and desc != '':
self.num_errors += 1
log.error("Incorrect PPD file for a print queue '%s'. Print queues must not use 'HP-Fax-hplip.ppd'." % printer_name)
log.error("Incorrect PPD file for a print queue '%s'. Print queues must not use 'HP-Fax(n)-hpcups.ppd'." % printer_name)
elif back_end not in ('hp', 'hpfax'):
log.warn("Printer is not HPLIP installed. Printers must use the hp: or hpfax: CUPS backend for HP-Devices.")