mirror of
https://github.com/nmap/nmap.git
synced 2025-12-06 04:31:29 +00:00
Populate jobname and owner even without Apple-specific attributes
This commit is contained in:
@@ -362,7 +362,7 @@ Helper = {
|
|||||||
{ tag = IPP.Attribute.IPP_TAG_KEYWORD, val = "job-name" },
|
{ tag = IPP.Attribute.IPP_TAG_KEYWORD, val = "job-name" },
|
||||||
{ tag = IPP.Attribute.IPP_TAG_KEYWORD, val = "job-state" },
|
{ tag = IPP.Attribute.IPP_TAG_KEYWORD, val = "job-state" },
|
||||||
{ tag = IPP.Attribute.IPP_TAG_KEYWORD, val = "printer-uri" },
|
{ tag = IPP.Attribute.IPP_TAG_KEYWORD, val = "printer-uri" },
|
||||||
-- { tag = IPP.Attribute.IPP_TAG_KEYWORD, val = "job-originating-user-name" },
|
{ tag = IPP.Attribute.IPP_TAG_KEYWORD, val = "job-originating-user-name" },
|
||||||
-- { tag = IPP.Attribute.IPP_TAG_KEYWORD, val = "job-printer-state-message" },
|
-- { tag = IPP.Attribute.IPP_TAG_KEYWORD, val = "job-printer-state-message" },
|
||||||
-- { tag = IPP.Attribute.IPP_TAG_KEYWORD, val = "job-printer-uri" },
|
-- { tag = IPP.Attribute.IPP_TAG_KEYWORD, val = "job-printer-uri" },
|
||||||
{ tag = IPP.Attribute.IPP_TAG_KEYWORD, val = "time-at-creation" } } ),
|
{ tag = IPP.Attribute.IPP_TAG_KEYWORD, val = "time-at-creation" } } ),
|
||||||
@@ -380,16 +380,19 @@ Helper = {
|
|||||||
|
|
||||||
local results = {}
|
local results = {}
|
||||||
for _, ag in ipairs(response:getAttributeGroups(IPP.Attribute.IPP_TAG_JOB)) do
|
for _, ag in ipairs(response:getAttributeGroups(IPP.Attribute.IPP_TAG_JOB)) do
|
||||||
local uri = ag:getAttributeValue("printer-uri")
|
local printer = ag:getAttributeValue("printer-uri"):match(".*/(.*)$") or "Unknown"
|
||||||
local printer = uri:match(".*/(.*)$") or "Unknown"
|
|
||||||
-- some jobs have multiple state attributes, so far the ENUM ones have been correct
|
-- some jobs have multiple state attributes, so far the ENUM ones have been correct
|
||||||
local state = ag:getAttributeValue("job-state", IPP.Attribute.IPP_TAG_ENUM) or ag:getAttributeValue("job-state")
|
local state = ag:getAttributeValue("job-state", IPP.Attribute.IPP_TAG_ENUM) or ag:getAttributeValue("job-state")
|
||||||
-- some jobs have multiple id tag, so far the INTEGER type have shown the correct ID
|
-- some jobs have multiple id tag, so far the INTEGER type have shown the correct ID
|
||||||
local id = ag:getAttributeValue("job-id", IPP.Attribute.IPP_TAG_INTEGER) or ag:getAttributeValue("job-id")
|
local id = ag:getAttributeValue("job-id", IPP.Attribute.IPP_TAG_INTEGER) or ag:getAttributeValue("job-id")
|
||||||
local tm = ag:getAttributeValue("time-at-creation")
|
local tm = ag:getAttributeValue("time-at-creation")
|
||||||
local size = ag:getAttributeValue("job-k-octets") .. "k"
|
local size = ag:getAttributeValue("job-k-octets") .. "k"
|
||||||
local jobname = ag:getAttributeValue("com.apple.print.JobInfo.PMJobName") or "Unknown"
|
local jobname = ag:getAttributeValue("com.apple.print.JobInfo.PMJobName")
|
||||||
local owner = ag:getAttributeValue("com.apple.print.JobInfo.PMJobOwner") or "Unknown"
|
or ag:getAttributeValue("job-name")
|
||||||
|
or "Unknown"
|
||||||
|
local owner = ag:getAttributeValue("com.apple.print.JobInfo.PMJobOwner")
|
||||||
|
or ag:getAttributeValue("job-originating-user-name")
|
||||||
|
or "Unknown"
|
||||||
|
|
||||||
results[printer] = results[printer] or {}
|
results[printer] = results[printer] or {}
|
||||||
table.insert(results[printer], {
|
table.insert(results[printer], {
|
||||||
|
|||||||
Reference in New Issue
Block a user