File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed
core/src/main/scala/org/apache/spark/security Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -30,6 +30,8 @@ import org.apache.spark.util.Utils
3030private [spark] class ShellBasedGroupsMappingProvider extends GroupMappingServiceProvider
3131 with Logging {
3232
33+ private lazy val idPath = Utils .executeAndGetOutput(" which" :: " id" :: Nil ).stripLineEnd
34+
3335 override def getGroups (username : String ): Set [String ] = {
3436 val userGroups = getUnixGroups(username)
3537 logDebug(" User: " + username + " Groups: " + userGroups.mkString(" ," ))
@@ -38,8 +40,7 @@ private[spark] class ShellBasedGroupsMappingProvider extends GroupMappingService
3840
3941 // shells out a "bash -c id -Gn username" to get user groups
4042 private def getUnixGroups (username : String ): Set [String ] = {
41- val cmdSeq = Seq (" bash" , " -c" , " id -Gn " + username)
4243 // we need to get rid of the trailing "\n" from the result of command execution
43- Utils .executeAndGetOutput(cmdSeq ).stripLineEnd.split(" " ).toSet
44+ Utils .executeAndGetOutput(idPath :: " -Gn " :: username :: Nil ).stripLineEnd.split(" " ).toSet
4445 }
4546}
You can’t perform that action at this time.
0 commit comments