Changeset 19:7fb86a552bad in iovar


Ignore:
Timestamp:
Feb 3, 2015, 4:32:16 AM (4 years ago)
Author:
Shawn Wilson <shawn@…>
Branch:
default
Phase:
public
Message:

saw_020315_4 - Add support for .ioshrc in /root/ and /home/$USER/.

Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • CHANGELOG

    r18 r19  
    11Copyright (C) 2011-2015 Lannocc Technologies
    22@%@~LICENSE~@%@
     3
     4saw_020315_4 - Add support for .ioshrc in /root/ and /home/$USER/.
    35
    46saw_020315_3 - Fixes on recent ShellSession work.
  • src/com/iovar/web/bin/shell/Interactive.java

    r16 r19  
    106106        */
    107107
    108         Log.debug ("remote user: "+req.getRemoteUser ());
     108        final String user = req.getRemoteUser ();
     109        Log.debug ("remote user: "+user);
    109110       
    110111        final ShellSession.Instance shell = ShellSession.get (req);
     
    131132            final Map<String,List<String>> params = new HashMap<String,List<String>> ();
    132133            params.put (Shell.EXT_PARAM_SESSION, Arrays.asList (new String[] { shell.getPath () }));
    133             Transport.handler (shrc, params, context).post (null, null);
     134           
     135            final Transport rc = Transport.handler (shrc, params, context);
     136            if (rc.exists ())
     137            {
     138                rc.post (null, null);
     139            }
     140        }
     141       
     142        if ("root".equals (user) || (user==null && "127.0.0.1".equals (req.getRemoteAddr ())))
     143        {
     144            final Map<String,List<String>> params = new HashMap<String,List<String>> ();
     145            params.put (Shell.EXT_PARAM_SESSION, Arrays.asList (new String[] { shell.getPath () }));
     146            final Transport rc = Transport.handler ("/root/.ioshrc", params, context);
     147            if (rc.exists ())
     148            {
     149                rc.post (null, null);
     150            }
     151        }
     152        else if (user!=null)
     153        {
     154            final Map<String,List<String>> params = new HashMap<String,List<String>> ();
     155            params.put (Shell.EXT_PARAM_SESSION, Arrays.asList (new String[] { shell.getPath () }));
     156            final Transport rc = Transport.handler ("/home/"+user+"/.ioshrc", params, context);
     157            if (rc.exists ())
     158            {
     159                rc.post (null, null);
     160            }
    134161        }
    135162       
Note: See TracChangeset for help on using the changeset viewer.