AnsweredAssumed Answered

Admin Console won't pass quoted parameters correctly to OSX system script

Question asked by AlanDeffenderfer on Jan 31, 2011
Latest reply on Mar 2, 2011 by TSGal

Summary

Admin Console won't pass quoted parameters correctly to OSX system script

Product

FileMaker Server

Version

11

Operating system version

Leopard Snow Server

Description of the issue

I should be able to run this script from the OSX FMS Admin console and pass 3 parameters: username, password and message

#!/bin/bash
fmsadmin disconnect client -yu"$1" -p"$2" -m"$3"

Steps to reproduce the problem

Try adding a scheduled script to the FM Admin Console that passes a parameter with spaces such as: "user name" "pass word" and "the message" Only one of the parameters needs a space and quotation marks for this to return an error. 

#!/bin/bash
fmsadmin disconnect client -yu"$1" -p"$2" -m"$3"

Expected result

I should be able to pass a parameter with spaces by putting it in quotation marks to tell bash to ignore spaces in the parameter. 

If I run the script above from terminal

sh /Library/FileMaker\ Server/Data/Scripts/disconnect_fmusers.sh "user name" "pass word" "the message"

This script works as expected in terminal with quoted parameters.

Actual result

When the FM Admin console passes the exact same quoted parameters to the OS, somehow the FM Admin Console is including the quotation marks as part of the parameter itself so that the script is literally using '"user name"' with the quotation marks instead of simply "user name" (without the quotation marks). The same is true for the other parameters that are in quotation marks.  Terminal does not behave this way.  I have only been able to recreate this issue on Leopard Snow Server with the FM Admin console. 

This issue prevents FM Server from running OS level scripts on OSX that pass usernames, passwords or messages that contain spaces. When a parameter to an OS level script has a space, it must be put in quotation marks to tell bash to ignore spaces for that parameter.

Workaround

I have have had to hard code usernames and passwords and messages with spaces in system level scripts (rather than passing them as parameters) which makes any server much less secure.

Outcomes