Praveen’s Journal

June 14, 2008

Modifying Control and Caps Lock keys under OpenSolaris and Linux

Filed under: General — Tags: , , , — Praveen Kumar @ 4:07 pm

Since I started using Emacs, I started using the Control key more than I had used it before. That is when I started using my Caps Lock key as Control key. In the beginning, I swapped the Control key and the Caps Lock key. However while doing pair programming on my computer, my colleagues found this setup a bit unfriendly. So, I decided to give up my Caps Lock key and started using Caps Lock as an additional Control key. Under Linux, Gnome has an option to do this using the “Keyboard Preferences” application. However I was not able to find this option in OpenSolaris Gnome. So, I have to take the old xmodmap way of doing this. This works under Linux as well. I hope that this would work on all UNIX variants that uses xmodmap. But I haven’t verified it personally.

To make Caps Lock key as an additional Control key, add the following to .Xmodmap file in your home directory. This configuration is automatically applied when you restart your X (Gnome) session. For the first time, you can manually apply this by running xmodmap ~/.Xmodmap.

!
! Make Caps Lock as an additional Control.
!
remove Lock = Caps_Lock
add Control = Caps_Lock

Please note that ! is the commenting character for xmodmap files.

But if you want to retain the Caps Lock function and swap it back to Control key, add the following to your .Xmodmap file.

!
! Swap Caps Lock and Control.
!
remove Lock = Caps_Lock
remove Control = Control_L
keysym Control_L = Caps_Lock
keysym Caps_Lock = Control_L
add Lock = Caps_Lock
add Control = Control_L

June 6, 2008

Privacy issue in Chennai Passport Office status enquiry page

Filed under: General — Tags: , — Praveen Kumar @ 10:08 pm

The site of Regional Passport Office of Chennai has a page to inquire about the passport application case status. If you just enter the passport application file number, the status of the case is provided. The output has information about the full name of the applicant, passport number, date of birth and the date of delivery of the passport. Please note that the input that is needed to fetch this data is just the application file number. No other verification information needed. This is a serious privacy issue. You can’t let your passport number and date of birth to be seen by random people. On the worse side, one can write a script to go through a list of file numbers and collect a database of these valuable information.

If I am correct, when I used this facility in 2003, I had to enter the application file number and my date of birth to fetch the information about any case. This was providing some level of authentication before disclosing the information about a case. Maybe this feature was broken and nobody noticed it. I have sent a mail to the Regional Passport Officer about this issue. I hope that they fix this issue soon.

June 5, 2008

Dumping core file from set-UID, set-GID ‘ed processes in Linux

Filed under: General — Tags: , — Praveen Kumar @ 8:08 pm

Lately I was encountering segmentation fault with one of our processes and found that it was not dumping core file even though we asked it by using appropriate ulimit setting. It was set-UIDed root. Then I discovered that the default behavior of set-UID, set-GID processes is not to dump core unless explicitly asked by prctl(2). In order to dump core, the following has to be done.

prctl( PR_SET_DUMPABLE, 1 );

I haven’t dealt a lot with set-UIDed processes. This was a valuable information to be leaned. Here is more information about this option.

       PR_SET_DUMPABLE
              (Since Linux 2.3.20) Set the  state  of  the  flag  determining
              whether  core dumps are produced for this process upon delivery
              of a signal whose default behavior is to produce a  core  dump.
              (Normally  this flag is set for a process by default, but it is
              cleared when a set-user-ID or set-group-ID program is  executed
              and  also  by various system calls that manipulate process UIDs
              and GIDs).  In kernels up to and including 2.6.12, arg2 must be
              either  0 (process is not dumpable) or 1 (process is dumpable).
              Between kernels 2.6.13 and 2.6.17, the value 2 was also permit‐
              ted, which caused any binary which normally would not be dumped
              to be dumped readable by root only; for security reasons,  this
              feature  has  been  removed.   (See  also  the  description  of
              /proc/sys/fs/suid_dumpable in proc(5).)

Powered by WordPress