ProfileCreator / ProfileCreator

macOS app to create standard or customized configuration profiles.
MIT License
1.27k stars 92 forks source link

AirPrint - Invalid value for key: Port #173

Open yusef-ho opened 5 years ago

yusef-ho commented 5 years ago

Hello, I was trying to create profile of airprint, but it shows Invalid value for key: Port

Screen Shot 2019-07-05 at 11 04 58 PM
apizz commented 5 years ago

@yusef-ho thanks for the report. Weird because the pfm_range_max in the manifest is set to 65535, so 3000 should be a valid port number.

In my test on PC 0.3.1 and macOS 10.13.6, I'm able to add numbers below 65535 and above 65535, but when I switch to XML view, while the port numbers are present, they are listed between string tags, rather than integer tags as the pfm_type in the manifest defines. So while I'm not able to reproduce your error message, I'm definitely getting some weirdness.

Screen Shot 2019-07-05 at 3 48 07 PM Screen Shot 2019-07-05 at 3 48 12 PM

Additionally, when I switch back to GUI view from XML view it removes the previously entered port numbers.

Screen Shot 2019-07-05 at 3 48 15 PM

@yusef-ho Can you provide some additional info - macOS version, ProfileCreator version, etc.?

yusef-ho commented 5 years ago

@apizz Thanks My macOS is 10.13.6 and ProfileCreator is 0.3.1 I tried another mobileconfig generated from another scripts, it works, and seems it should be integer?

apizz commented 5 years ago

@yusef-ho I've tried a machine on 10.12.6, 10.13.6, and 10.14.5 all on PC 0.3.1 and despite the AirPrint manifest defining the pfm_type of the Port setting as integer, in the GUI view it appears as a string.

In all of my tests, putting a number larger than the defined pfm_max_range does not produce the error message, perhaps because of this incorrect parsing of the preference key as a string instead of an integer ? ...

Screen Shot 2019-07-16 at 1 32 23 PM

In any case, I still have yet to reproduce your original error message. But something weird is definitely going on that leads me to believe there's a bug somewhere. I'll keep looking.

In the meantime (if you haven't done so already), you can export your profile or plist with PC and then manually edit the Port value to achieve the desired result.

amandaw33 commented 4 years ago

I'm getting this error trying to use port 9164. macOS 10.14.6 and Profile Creator 0.3.2

apizz commented 4 years ago

Yes, @amandaw33 this appears to still be an issue. I've tried everything that I can think of - bumping the modified date and manifest version, but it appears that no matter what is entered in the Port text field what starts out as an integer instead becomes a string, thereby producing an error when you try to create a profile.

The only workaround that I can offer is to leave the default port of 0 entered, as this maintains the proper integer XML tags, export the profile, open the .mobileconfig file in a text editor, and manually enter the desired port number for the preference.

Definitely a pain and not ideal, I know ...

amandaw33 commented 4 years ago

Thanks- this actually is a fine workaround. I had tried that before posting but for some reason it didn't work that day, I must have futzed something up. Works fine! thank you.

Yes, @amandaw33 this appears to still be an issue. I've tried everything that I can think of - bumping the modified date and manifest version, but it appears that no matter what is entered in the Port text field what starts out as an integer instead becomes a string, thereby producing an error you try to create a profile.

The only workaround that I can offer is to leave the default port of 0 entered, as this maintains the proper integer XML tags, export the profile, open the .mobileconfig file in a text editor, and manually enter the desired port number for the preference.

Definitely a pain and not ideal, I know ...

apizz commented 4 years ago

More detailed workaround steps are available from the wiki, here: https://github.com/ProfileCreator/ProfileCreator/wiki/AirPrint