Using previously developed code for research at a new place My ex student developed a useful program while working with me and some other students/postdocs in my group.

Nowadays the student is a postdoc at a European university. She has a copy of the code and applies it sporadically. Recently she informed me that her current supervisor requested her to share this code with him, in quite a rude way, because she used the code to compute something for her ongoing job at her university.

There is no reason to share the code and I, as a coauthor, rejected that. What should be her correct answer to her current supervisor?
1) In retrospect it would obviously have been useful to establish general rules about using the code in advance. Is the code public? Is it available for use by any of the original co-authors without having to include the other authors on future publications? Can it be shared with or without consent from the original co-authors? Any of these rules are fine, they just have to be agreed on in advance. 

2) Now that the code was used in a new project I strongly sympathize with the request of your students supervisor. I would be very uncomfortable publishing a paper based on a code that I have no access to. It means that I cannot verify the results in my own paper!

3) In sharing the code with colleagues it is perfectly o.k to restrict future use. You can say ``I'm sharing this code for the purpose of verifying the work on your current project, but if you wish to use it in the future you have to ask permission/include an acknowledgement/add me as co-author/etc. (whatever you and your authors feel is appropriate)".

4) Personally, I am strong believer in open software. If you publish a paper based on a code, the code should be made public. However, this is not a commonly accepted standard, and restricted and proprietary codes are common in many areas of science.