March 2008 Archives

2008-03-28 22:14:54

Insanity for beginners: undeleting open files

If you have accidentally deleted a file which is still open, there is an easy way to undelete it. For this stunt, please make sure that the /proc file system is mounted.

First, we create a file to test with:

$ echo test > testfile
$ sha1 testfile
4e1243bd22c66e76c2ba9eddc1f91394e57f9f83
$

Then we create a process to hold the file open:

$ tail -f testfile &
$ test

Then we delete our test file:

$ rm -f testfile
$

Now we determine the PID of the process which holds our file open:

$ ps waux | grep [t]ail
tonnerre 5962 0.0 0.0 44 616 ttyp8 S+ 10:45PM 0:00.01 tail -f testfile
$

The remaining question is: which file descriptor is the one we're looking for?

$ ls -l /proc/5962/fd
ls: 8: Bad file descriptor
total 2
crw--w---- 1 tonnerre tty 3, 8 Mar 29 22:45 0
crw--w---- 1 tonnerre tty 3, 8 Mar 29 22:45 1
crw--w---- 1 tonnerre tty 3, 8 Mar 29 22:45 2
-rw-r--r-- 1 tonnerre staff 5 Mar 29 22:45 3
lr-xr-xr-x 1 tonnerre staff 0 Mar 29 22:45 4 -> [kqueue]
prw------- 1 root wheel 0 Mar 29 22:45 5
prw------- 1 root wheel 0 Mar 29 22:45 7
$

The only normal file here was 3, so let's get hold of it!

$ ln /proc/5962/fd/3 test
$ sha1 test
4e1243bd22c66e76c2ba9eddc1f91394e57f9f83
$

Congratulations! We got our file back.


Posted by Tonnerre Lombard | Permanent link | File under: programming, general

2008-03-22 01:03:25

Novell emphasizes its position as Microsoft mole with OpenOffice.org

Novell, the Microsoft contract partner who recently bought the Gesellschaft für Software- und Systementwicklung (SuSE) and as such entered the marktet of commercial Linux distributors, has again emphasized its position as Microsoft mole in the Open Source Community – with OpenOffice.org.

Nowadays, most Linux distributions use the Novell build of OpenOffice.org for historic reasons. Originally, the OpenOffice.org community did not have the capabilities to offer an up-to-date build in a timely manner, so everyone fell back to the Novell build, which was usually very much up to date.

Nowadays, OpenOffice.org provides its own, very useful and stable build. However, most distributions did not adapt their packaging tools to this fact so far, and are still distributing the Novell build. Which – as it turns out – has some interesting fallacities. These are mostly bugs or build environment incompatibilities which cause the experience of running OpenOffice.org to be significantly impaired.

It is of course nevertheless a good question whether or not this is caused by a policy on behalf of Novell, or pure negligence of their build environment. Either way, it does not show a high value associated with the Open Source Community on behalf of Novell.

History

In the past, speculations about the questionable usefulness of Novell to the Open Source community had already been raised – especially in the question of the Mono-ization of Gnome. Also, concerns had been raised about partiality in the debate about OOXML, which is closely related to the Office debate since OpenOffice.org is the most popular implementor of the Open Document Format (ISO 26300) and as such in direct competition to the MS-Office-only newcomer standard OOXML.


Posted by Tonnerre Lombard | Permanent link | File under: news, standards

2008-03-22 00:30:02

No more no DMCA?

The No DMCA site, which originally showed information and a petition against the Swiss copyright revision, appears as defaced now. Evidently, the owner decided to delete the vhost – for whatever reason.

Unfortunately, this also means that all links to the domain are now broken. More than that, the author originally asked for contributions to a new revision (in accordance with FFII's recommendation. Evidently, all these contributions are now lost along with the site.

Rest in pieces, no-dmca.ch!


Posted by Tonnerre Lombard | Permanent link | File under: news, politics

2008-03-21 17:13:39

nagios-plugin-snmp and creative use of asprintf

While creating a security patch to the old version 1.4.3 of nagios-plugin-snmp, I noticed that the use of strcat to write a dynamic string into a static buffer was not the only mistake that had been made.

The following code can be found in an older stable version of the nagios SNMP plugin:

char perfstr[MAX_INPUT_BUFFER];
...
char *str[MAX_INPUT_BUFFER];
asprintf(str, "=%s%s;;;; ", show, type ? type : "");
strcat(perfstr, *str);

The original problem here was the unchecked strcat to a static global buffer, which caused a rather classic buffer overflow. Much more interesting was however the use of asprintf(3) here. asprintf allocates enough memory to hold the created string and sets the pointer, the first argument, to the address of the allocated memory. So what the nagios people did was to allocate an array of MAX_INPUT_BUFFER pointers to strings, and the first of these pointers was set to the string. Incidentally, this even works – however, this situation is a clear memory leak.

To point out the positive: this very creative use of asprintf gave me a good laugh.


Posted by Tonnerre Lombard | Permanent link | File under: programming

2008-03-20 21:14:03

15 years NetBSD

15 years ago, the network community had decided to polish up the old 4.2BSD source code and to create a new, free operating system from it. Due to the fact that the creation of this new operating system was only possible due to the Internet, the new system was called NetBSD.

Congratulations and best wishes for the next 150 years!


Posted by Tonnerre Lombard | Permanent link | File under: programming, general

2008-03-20 16:52:02

Microsoft disses its new productivity suite, calls Outlook volatile

In its latest advertisement, Microsoft shows little confidence in its latest productivity suite «Microsoft Dynamics». For Outlook, the judgement is even worse: it is paraphrased as volatile.

Do you need to rescue your segment of fresh products from expiration by selling? Now, this task is as simple as writing a mail in Outlook.

Certainly, no product can influence the volatility of the market. It is not a question of the product in use whether or not you can manage to sell your fresh products before they expire. Normally, in the end of the day, a small amount of fresh products is still left, because in order to serve all customers, there must be slightly more offer than demand in this sector.

So evidently, the point Microsoft is trying to make is that Outlook's behavior when sending mail is rather volatile and that it never really works out fully except in really rare cases.

On the other hand, Outlook is known to send weird documents instead of E-Mails, such as, for example, HTML format or even RTF and MS-TNEF. Also, Outlook tends to bug out when encountering various attachment formats, such as, for example PGP signatures. This means that it is not really usable as a mail program, and best replaced with a different mail product, such as, for example, Claws Mail.

Since the advertisement explicitly declares the usability of the two applications as equivalent, this means that Microsoft has given itself a pretty bad evaluation of its new productivity suite – the notion of being barely usable.


Posted by Tonnerre Lombard | Permanent link | File under: general