Search Results: "cas"

24 November 2005

Joachim Breitner: My Code in Pakistan

Free Software ist just great: I got an e-mail from a fellow in Pakistan, just thanking me for udp-broadcast-relay, a very small tool that lets UDP broadcast cross IP subnet boundaries. He writes that, after dividing his net, he needed that tool to keep vyqchat working. He also replied when I asked him to tell me a bit more about his setting, telling me that he uses Mandrake and Fedora Core and some personal details.While this was not the first time something like this happened - someone from Norway once called me one Sunday morning, and I got mails from the US - but Pakistan is really a surpise to me. Also considering that I just released two versions two years ago and didn’t do anything since...

23 November 2005

Antti-Juhani Kaijanaho: The Finnish Criminal Court System

(Reposted from old blog) Inspired by Matthew Palmer’s writings (1, 2) on his experiences about the Australian judicial system, I decided to write a series of essays on the Finnish legal system, mostly to contrast it with the universally familiar United State system (even if that universal familiarity is a little skewed by generally having been obtained from dramatizations and not actual court practice). I will concentrate on criminal cases. I will write based on my personal experience as a part of the judicial system, and I will be supplementing the experience with my personal research into law. I am not legally trained, but I have read a fair bit of law and related literature. I am a lay judge in the Jyv skyl District court. I will explain the significance of that later, but I hope it suffices to say, here, that I have sat on the bench, as part of four-judge panels, since March this year, in ten sessions each a day long, and each containing at least two, usually four or five criminal cases. Some highlights: Later essays in this series: Fictional depictions of court cases in this series: Read more

Antti-Juhani Kaijanaho: Constitutions and countries

Some people think that only countries have constitutions. I find that strange, since both write at Planet Debian; surely, Debian is not a country! [Update: As hinted in the comments, I did not get MJR's posting. My bad. Let it be known here that he expresses roughly the same argument I presented above.] In fact, the European Union is a country. It has a bicameral parliament (the council of ministers is sufficiently upper-house-like to qualify as one IMHO), a currency it governs, a passport, and it is the highest authority inside its borders. It is an unusual country in that its meber states have broad powers, but it is a country nonetheless. It possesses all four of the defining properties of statehood according to the Montevideo convention: The state as a person of international law should possess the following qualifications: (a) a permanent population; (b) a defined territory; (c) government; and (d) capacity to enter into relations with the other states. The first three are uncontroversial, and though the fourth is weak, it is present. (Okay, that last paragraph is controversial, and I know the arguments are not airtight, but I do believe the case is valid.)

Antti-Juhani Kaijanaho: On the European Union Constitution

Jordi Mallach expressed fear, uncertainty and doubt about the European Union Consitution. I would like to make the following two points:
  1. Much of what is in the proposed Constitution is already in force as part of the current foundational treaties. So, if you read the Constitution and want to bash it, please read also the current treaties. I expect you to find it to be clearer and content-wise quite similar to them. So don't think that this document is an evil attempt to seize power or something (well, it might be that but I doubt it).
  2. A change to the current foundational treaties would be necessary in any case. The acceptance of new member states makes decision-making by the current rules difficult, if not impossible.
I assume most of the FUD spring from the grand name of the new document, a Constitution. It deserves the name quite rightly. It is the sole foundational document after it is accepted, replacing quite a few treaties. However, its impact is mostly illusory. A similar change was done in Finland a few years ago, when the three constitutional statutes (none of them called the Constitution) were combined and updated into a single law called the Constitution. (Long-time Debian developers probably remember my ill-conceived ITP from four years ago:) Perhaps this FUD is exactly why the consitution should not be subjected to referenda. I don't doubt that Jordi is not alone in his feelings, and such feelings could easily cause it to fail in a referendum. The only effect of such a failure would be making decision-making in the EU painful, without actually addressing the issues people have, such as Jordi's regional issues.

Antti-Juhani Kaijanaho: I have a request for Planet Debian bloggers

If you have a firm opinion about the latest general resolution vote, please publish your ballot, and an explanation of your reasoning, in your blog (and hence in Planet Debian). Note that the ballots will all be published after the vote, so there is no voter confidentiality protecting your ballot in any case, and hearing your arguments will help people like me, who are undecided, to decide. I'm not looking to imitate anyone in my voting behaviour, but after the previous vote, I don't trust my personal reading of the proposals to be accurate or at least to reflect the reading that matters. Julien Danjou already explained his position:
Since I think we have to release Sarge as soon as possible in order to satisfay our users, I have just voted for postponing changes until Sarge is released.
Julien, I would like to ask you to publish and explain your full ballot. There are a lot of options in there, and it is not at all clear, at least to me, how one would order them to bring about a release of Sarge as soon as possible (note that I am as of yet undecided on even whether I want that or not:).

Antti-Juhani Kaijanaho: Yet another case of C++ unsafety

I was playing around with BNFC's C++ mode, and discovered that its authors have fallen prey to two of C++'s famous pitfalls: Were you aware of these issues? :) I fixed these problems in BNFC with this patch.

Antti-Juhani Kaijanaho: Safety is the beginning of wisdom, not its end

I wrote a couple of days ago about safety in programming languages. A certain comment reminded me that people (even programmers) misinterpret technical terms from the area of programming languages. It reminds me of that old joke about the C programmer who is very hurt when somebody claims that C is not a functional programming language - of course it is functional, our hero says, as it functions perfectly. It also reminds me of a quote Christopher Strachey has been said to have written in the 1960's:
It has long been my personal view that the separation of practical and theoretical work is artificial and injurious. Much of the practical work done in computing, both in software and in hardware design, is unsound and clumsy because the people who do it have not any clear understanding of the fundamental design principles of their work. Most of the abstract mathematical and theoretical work is sterile because it has no point of contact with real computing.
In programming languages jargon, safety is the property of a language that all well-formed programs have a well-defined semantics. That is, in a safe language, programs that the compiler does not reject, do not go beserk (corrupt the stack or heap or otherwise invoke nasal demons). A well-defined semantics might be a forcible halt of the program, which is often not the ideal way of dealing with problems (sometimes it is even harmful), but it is beyond the scope of safety to specify a programmer-friendly semantics for such occurrences. Safety is the minimum requirement, not by any means sufficient for all contingencies. There is a related slogan attributed to Robin Milner:
Well-typed programs do not go wrong.
(Wrong, in this case, is an abstraction denoting nasal demons, heap corruption and other such nasty things.)

Antti-Juhani Kaijanaho: C++ exceptions revisited

I wrote two days ago:
Is there a mechanism to figure out what exception it is that fails to be caught by any exception handler on the stack? Of course, it can be caught by using catch (...), but that just tells me as much as G++'s default handler: that some exception was thrown.
Matus Telgarsky later pointed out to me in private mail that G++ does have a better terminate() handler, used by default in G++ 3.4. I could also invoke it in older G++ by adding
std::set_terminate( __gnu_cxx::__verbose_terminate_handler );
which I did. Based on the information it gives I eventually tracked the problem to my use of safe_ptr<AbSyn::AST>::release in my safe_ptr-downcasting functions in ast.hh. I had written that code originally using std::auto_ptr but due to problems I then implemented a reference-counted replacement for it. I had tried to make safe_ptr's interface to look as similar to std::auto_ptr's interface as possible, which now turned out to be a mistake. It turned out that there were four active aliases for things I passed to release at the time, which quite appropriately triggered an exception. However, unfortunately, I had given the downcasting functions exception specifications not listing that particular exception. Now, the semantics of an exception not listed being thrown in such a situation is that the program is immediately terminated. This problem highlights a C++ exception misfeature: it allows calling a function without an exception specification (which essentially means that it might throw anything) from a function with an exception specification (where throwing an exception not listed invokes immediate termination) without so much as a warning to guide the programmer!

Antti-Juhani Kaijanaho: C++ exceptions considered harmful

Is there a mechanism to figure out what exception it is that fails to be caught by any exception handler on the stack? Of course, it can be caught by using catch (...), but that just tells me as much as G++'s default handler: that some exception was thrown. I've been implementing the Hao compiler in C++, as C was too low-level but I wanted something widespread. A public darcs repository is available for curious bystanders to stare at; I doubt anybody gets much out of it (the haoc/ subdirectory contains the compiler in development; the other directories are more or less stale). I push to that repository occasionally; it's not necessarily up to date.

Antti-Juhani Kaijanaho: ID6

As I start to write this, it's the last minute of my country's 87th birthday (the Finnish Independence Day). It got me thinking about nation-states and independence and whatnot. And I came to a threefold conclusion: First, there is some value in independence. Getting rid of the status of a Grand Duchy in personal union with Russia was certainly a good step for Finland, in light of the rough road the Russians themselves have since travelled. For the same reason, the two wars Finland fought against the USSR were quite worthwhile. Similarly, if Finland were to be threatened by a neighbour again, armed defense would certainly be justifiable. Second, there is no intrinsic value in independence. If a humanly life (including freedom and local government) can be guaranteed even if there is no Finnish state in itself, I see no reason to hold on to the old-fashioned concept of a nation state. Third, I am in favour, as a long-term goal, of a world government. Of course, a single government becomes a single point of failure in case of a coup, for example, but if the global state is arranged properly, the danger of a successful coup is minimal. On the other hand, a world government is in far better position to institute necessary policies to combat the global problems of poverty, climate change and other such issues than the current system of competing and cooperating nation-states. In the current system, the big issues are easily put aside in name of local opportunism. Finland is by no means immune to that problem. The great crises of the 20th Century were its devastating wars. Fortunately, we have overcome them to a sufficient degree. The great crisis of the 21st Century is not terrorism - though it is a symptom. The great crisis is caused by the limits of growth, and we are already feeling quite concretely the nearness of those limits. If something is not done, our current civilization will crash spectacularly. The human race will probably survive - but do we really want to live through another Dark Age? Long Live the Earth!

Uwe Hermann: Hosting problems

As you might have noticed my site (+ my podcast + my photoblog) was down for a few days. I am experiencing unforseen hosting problems, and maybe there will be another downtime while I move the site to a more stable location. However, the site should be back for good real soon now. I apologize for the trouble.

22 November 2005

Clint Adams: GUI music players

First, I should point out that I hate GUIs. Then I should point out that I don't want to play music with a GUI music player. I'm including ncurses-type things like cplay in the GUI category. They've always made my skin crawl. So, why am I testing out GUI music players? It's because I didn't didn't realize that I misread the Audioscrobbler spec. Now that we've established that I don't know what I'm talking about, let's move on. Yesterday, I followed the suggestion of some KDE people and tried amaroK. I was pleasantly surprised. It was pretty, it was functional, the UI didn't piss me off, and it kept showing me a picture of Mako for some reason I still can't figure out. Here's where it fell down: it wanted me to select tracks based on album/artist info in the file tags; the musicbrainz lookup function is not as useful as tp_tagger; when I tried to play tracks off of a slow networked filesystem, it skipped a bit, then it shoved its head up its ass and ate itself. It managed to finish the track before it disabled its frontal lobe, but it didn't send the data to last.fm. So, amaroK was a lot better than I expected, but unacceptable. People seem to like Quod Libet. Joey and Erinn. So when I tried it today, I didn't expect it to be awful. Here's what it has over amaroK: it doesn't fall over and die when trying to deal with files on a slow networked filesystem. It just skips. You may be thinking that this could be easily solved with proper buffering. I'd think that too, if it didn't skip when playing files on the local hard drive. You may be wondering why I'm trying to play music on an old 486. I'm not. This is a Pentium 4 2.8GHz under almost no load. This is ridiculous. Compared to amaroK, this thing is ugly as sin, and incredibly awkward. That includes the metadata editor that people keep raving about for some reason. Furthermore, when I rearrange songs in the Play Queue, it occasionally ignores me and plays the track that used to be at the top of the list. Rhythmbox also has problems with skipping, so I guess that gstreamer is the devil. I'm not filing bugs because I don't intend to ever use these programs again.

Jesus Climent: On the case of Sony and its rootkit.

RIAA president Cary Sherman said he hoped the legal action would prompt parents to pay more attention to potentially illegal activities by their children. Now, substitute "RIAA president Cary Sherman said he hoped" with "We consumers hope", "parents" with "Sony and other companies" and "children" with "DRM software". If Grokster is responsible for what users do with their software, what makes Sony less responsible for what the software does to its users?

Edd Dumbill: Opinions and opinionated software

Since interviewing the creator of Ruby on Rails, David Heinemeier Hansson, I've been thinking a little more about what he calls "opinionated software." That handy little phrase seems to sum up what attracts me to a lot of technology, at all levels. What I like Free software--it's not really economics that drew me to free software, but the principles and aims. When you release or use free software, you're exercising your right to free speech and adding your voice to an argument. Desktop environments--GNOME 2.0: The move from GNOME 1.0 to version 2.0 was highly opinionated (Mac users, think OS 9 to OS X). Complexity of user interface was thrown out in favour of sensible defaults. Web standards--CSS, RDF, XHTML: not only is there a right way to do things, but it turns out to be better too! I don't automatically fall in love with everything that emerges from the W3C, but some things are so obviously the right way it's impossible not to love them--warts and all. Muine music player--this player throws out the paraphernalia of iTunes clones and gets you close to the music. Queue, play. What I want to do. Epiphany web browser--a simple text bar does for bookmark lookup, search and URLs. The bookmarks work like del.icio.us tags. Despite the lure of Firefox extensions, simplicity and efficiency keeps me with Epiphany. Make friends and enemies The thing about opinions is that people are inclined to disagree with them. Opinions won't please everybody and, being opinionated, you will never carry everybody with you. But opinions give you something with which to scythe through indifference. In both my writing and software development work taking a particular stance enables me to create interest, and gives direction to my projects. I tend to get bored easily, and if I'm bored, then my readers and users will never make it. Being opinionated in software development is easier when there's a strong leader, or it's a one-person project. It's more of a dilemma if you're running a free software project with multiple contributors. Such projects need such contributions, but run a risk of losing focus and style. I think that there we need to be brave again. If being opinionated means losing potential users, it also means losing potential contributors. Opinions help in dealing with users, too. It's obvious that the mere act of listening to users isn't good enough. They often won't say what they mean, or their requests mask a deeper issue. How often have you given your boss exactly what he asked for, to find it wasn't what he wanted? A combination of reading-between-the-lines and having opinions helps cut a way through the noise of user feedback. Stirring the pot Here are a few wishes for some free software projects that I want to see succeed further, but which really need to get opinionated to be effective. These projects aren't failing, but they're not reaching the potential I know is there. Each of them are infrastructural in some way, and that's probably where the temptation to avoid being opinionated is strongest. But here's the genius: the rewards of being opinionated here are high. Ruby on Rails is the existence proof. What's better? A handful of users with the "right" idea about how fundamentally important you are to everything, or loads of users who only see a portion of the capabilities of a project? Copy the experts It may seem like cheating to copy Apple's lead, but a lot of what they've done in OS X is to take a stand on what's useful and not. On many occasions this has inconvenienced people, but it's not eroded that special lure that Apple products hold. There's not harm in asking "What have Apple done?" with some of our projects. Another poster-child for being opinionated is Ubuntu Linux. Technically, it's only marginally better than other Linux distributions. Strategically, it's miles ahead. Its founder, Mark Shuttleworth, had very solid opinions about where Ubuntu should go, and pursued them. Over time, these have pervaded the product itself, but at the start it was the message and the style that made the difference. Opinions not expressed are rarely effective.

Antti-Juhani Kaijanaho: Driving While Intoxicated &ndash; A Glimpse of Finnish Criminal Justice, Part One

This posting is part of my Finnish criminal court series. See the introductory essay for more information and an overview of the Finnish criminal court system. The following is a fictional account of a criminal case, one of the most frequent ones, written in the form of a play script. A PDF is also available. There is also an OpenOffice-generated XHTML renderition, which may be more pleasant to read than the version below (but lacks most of its logical markup). DRIVING WHILE INTOXICATED
A glimpse of Finnish criminal justice
Part One Dramatis personae
Presiding judge
Prosecutor
Defendant Extras
Three lay judges
Court reporter Sets
Courtroom
Courthouse lobby DISCLAIMER This is a work of fiction. Although this play is based in general terms on real life, all the specific characters and events portrayed or described in this play are fictitious, and any resemblance to real people or events is purely coincidental. The verdict presented is fictitious, and while it is based on the author's understanding of the law, it may be erroneus. No legal advice should be inferred from this work of fiction. Scene One: And so it begins The courtroom is about the size of a large school classroom, and shaped as a rectangle in terms of floor layout. The judges' bench, a long wooden table, lays near one of the short walls; the space between the bench and the wall is enough to give the judges and the court clerks comfortable room to sit and to move behind the sitting judges. At the center of the bench is the seat of the presiding judge, who has easy access to a telephone, a public address system and a panel for controlling the LED display visible in the lobby above the courtroom door. To his or her right is the court reporter's seat in front of a PC and in control of recording equipment. To the reporter's right there is room for one additional individual. To the presiding judge's left, there are three chairs for the lay judges. If one were to stand directly opposite the presiding judge, on the other side of the bench, one would find an open Bible. In front of the bench, disregarding the Bible, there is some room, approximately two meters or so. Along each long wall there is a small table, and those two tables face each other, and are therefore turned sideways from the bench's point of view. By the desk on the bench's right is the seat of the prosecutor, and the other, facing desk is reserved for the witness being examined. Facing the bench, separated from it by that empty space, are two rows of tables with chairs. Beyond them there are two rows of seats for the audience without tables; the farther row is right at the other short wall. The long wall to the judges' right contains one double door leading to the court building lobby, and the other long wall contains two sets of double doors at each end of the wall, leading to a part of the building not accessible to the public. We'll call the door closer to the bench the judges' door. The PRESIDING JUDGE is a 50-something man dressed formally in black and blue. The three LAY JUDGES are more casually but still essentially formally clothed. LAY JUDGE ONE is a sixty-something male, LAY JUDGE TWO is a female in her fourties and LAY JUDGE THREE is a female just under thirty. The COURT REPORTER is a female in her fifties, also dressed formally. It is 9:00. The four JUDGES and the COURT REPORTER are sitting on the bench. Each JUDGE has papers in front of him or her, the PRESIDING JUDGE's stack being by far the thickest. The PROSECUTOR, fourty-something man, enters through the judges' door, carrying law books and a large stack of paper. He sits down at his desk. PRESIDING JUDGE (Nodding to the prosecutor.) Okay. Let's start. (Enters codes on the LED machine. Then picks up the public address microphone.) The criminal case 'prosecutor against Matti Meik l inen' begins in room three. Parties to room three. Scene Two: Main hearing The DEFENDANT enters through the double door from the lobby. He feels a little lost. PRESIDING JUDGE (To the defendant:) Matti Vihtori Meik l inen? (DEFENDANT nods.) Please, take a seat in the front row. (He waits for the defendant to comply.) This case will be tried as follows. First, the prosecutor will read the charge. You will then respond by telling us if the charge is correct or not, that is, if you in fact did commit the acts specified in the charges, and if you did not, or the charge is only partially correct, you should state briefly why the charge is in error. The prosecutor will then present the case, he will describe us his understanding of the events in question. When he is finished, you will again have opportunity to state if the prosecutor is correct or not, and if not, in what way is he wrong. If there is disagreement between you and the prosecutor, we will hear the evidence. After that, the prosecutor will state his or her concluding opinion of the case as presented here. Again, you will have the opportunity to respond. We will conclude with discussion of what punishment, if any, would be appropriate. The court will then discuss the case alone, and will finally announce the verdict. Is this understood? (DEFENDANT nods.) Okay. Prosecutor? PROSECUTOR (Reads the charge from a paper everyone has in front of his or her.) I demand punishment to Matti Vihtori Meik l inen for driving while intoxicated. Matti Vihtori Meik l inen had on the first of May this year operated his car while his exhaled air contained 0,597 milligrams of alcohol per liter. Matti Vihtori Meik l inen's driving license must be suspended. PRESIDING JUDGE (To the defendant.) Is the charge correct? DEFENDANT Yes, it is. PRESIDING JUDGE Okay. The prosecutor will now tell us the circumstances and events in detail. PROSECUTOR Thank you. It was to my understanding late evening on May day, and the defendant had come from a bar and was apparently trying to move his car to a cost-free parking space. A police patrol happened to observe this and the defendant had apparently been a little shaky in his walking, so the officers gave him a breathalyzer test, which showed significant alcohol content. The defendant was brought in the station where a precision test was performed. The first reading was 0,597 and the second reading was 0,617; the mean of these two is 0,607, and after performing the confidence subtraction, the reading 0,597 milligrams per liter was obtained. PRESIDING JUDGE (To DEFENDANT) Well then, is what the prosecutor just said true? DEFENDANT (Speaking in a colloquial manner and very somberly. He is ashamed and wishes this would be over soon.) Yeah, it is. PRESIDING JUDGE All right. It seems to me that there are no points of disagreement, so we don't need to hear witnesses. (The PROSECUTOR nods.) Okay, it's time for the concluding statements. I think we will hear consequence opinions at the same time. Prosecutor? PROSECUTOR Thank you. I don't think there is much to say. The case has been shown beyond reasonable doubt, in my opinion. We have the precision test readings and the defendant's admission. As to the penalty... the amount of alcohol we are talking about is just below the limit for serious intoxication, so this is no small deal. On the other hand, the circumstances were not very dangerous. I think suspended imprisonment could well be considered, though a stiff fine would probably be more appropriate. The driving ban must be fairly long, obviously. PRESIDING JUDGE All right. (To the defendant.) Do you have anything to say before we adjourn to consider the case? DEFENDANT Well, I suppose it's clear that something is going to be given to me. I prefer a fine, naturally. PRESIDING JUDGE Naturally. The court will consider all options. Do you have any special requests concerning a driving ban? DEFENDANT As short as possible, of course. PRESIDING JUDGE Do you have a particular need for a car, do you need it for work, for example? DEFENDANT No. PRESIDING JUDGE Okay. Now, your income. We have here the last completed tax report for you, it says you earned 500 euros a month and had no children. Has this changed? DEFENDANT No change. PRESIDING JUDGE Okay, thank you. If you will then go outside to wait while we consider this case, thank you. The DEFENDANT exits to the lobby, the PROSECUTOR exits through the judges' door. Scene Three: Deliberation We are now in the lobby outside the courtroom. There are many doors that lead to many courtrooms. Above each door, attached to the wall, is a display showing the current case number; there is also a light saying do not enter, which is lit for most of the rooms, including Three. Also there is a numeric display which is out at the moment for most of the rooms. For some rooms, they indicate when the session will resume. Each courtroom door also has a paper pasted to the door frame listing the cases for the day. The door leading outside is separated from the lobby by a routine security check area, and one of the courthouse police guards stands there waiting for people to enter. Some other guards and janitors sit in their glass booth. There are many people sitting on the chairs, waiting for their turn to enter one of the courtrooms. DEFENDANT enters from the Courtroom Three door and sits down, waiting. It takes about fifteen minutes. During this time, announcements from other courtrooms could be occasionally heard, and people would enter or exit other courtrooms. Then... PRESIDING JUDGE (Over the PA) Verdict in the case 'prosecutor against Matti Meik l inen' in Courtroom 3. DEFENDANT exits through the Courtroom Three door. Scene Four: The Verdict The DEFENDANT enters from the lobby and sits down. After a minute, the PROSECUTOR rushes through the judges' door. PRESIDING JUDGE (Announcing to all people present.) The District Court has examined this case and has decided that Matti Vihtori Meik l inen did in fact commit the crime he was accused of in the way specified in the charge. The justification is the combination of the measured alcohol content in Meik l inen's breath and his own admission of guilt. Matti Vihtori Meik l inen is therefore sentenced to pay sixty-five day-fines, that is three hundred and ninety euros. Penal code, Chapter 23, Section 3. His driving license is suspended until the first of November this year. Road Traffic Act Section 75 Paragraph 1. One who is dissatisfied with this verdict can appeal it to the Vaasa Apellate Court within thirty days. Dissatisfaction must be declared, however, either right now to me or within a week to the Office of this District Court. (To DEFENDANT) Come and take the fine ticket and written appeal instructions (DEFENDANT takes those from the COURT REPORTER.) This hearing is concluded. The DEFENDANT leaves, as the court and the prosecutor prepare for the next case. TO BE CONTINUED
(with the next case)

Sam Hocevar: Suspicious Activity? Indeed

The Bad Plus I spent the whole weekend looking for a DRM-encumbered Sony CD so that I could check for myself whether my code was really being redistributed without permission. I eventually found one: Suspicious Activity?, by The Bad Plus. A rather enjoyable post-modern jazz album. I am rather lucky, it could have been C line Dion. As expected, installing the CD s custom player also installed a stealth aries.sys driver along with a few other interesting files such as $sys$DRMServer.exe, all hidden in a $sys$filesystem directory. I rapidly got rid of this cruft and started studying the really important file, ECDPlayerControl.ocx. It is the file Sebastian Porst and Matti Nikki found to be containing parts of mpglib, LAME, faad2, VLC... Suspicious Installer? Evidence that the DRMS code comes from VLC There are of course obvious similarities between some functions and structures of ECDPlayerControl.ocx and the ones in VLC s source. However, given how precise the implementation of a cryptographic protocol needs to be, the possibility that two separate implementations show many similarities must not be dismissed. The data structures and constant tables especially are likely to be identical. I think however that I found strong enough evidence that this is not the case here. The original drms.c was written by Jon on 01/05/04. I then hacked on that file on 01/18/04 and reorganised it, also replacing the reverse-engineered MD5 and AES functions with clean implementations, then Jon added DRMSv2 support on 05/05/04 and I reorganised the code again on 05/08/04. Some of these changes were specific to VLC (not in that they made the code unusable outside of VLC, but rather that they made it possible to use an external MD5 hash provider, for instance), so they were the bits I was looking for in ECDPlayerControl.ocx. For instance, Jon s original code had the following instruction:
p_acei[ 4 ] = 0x5476212A;
Since all bytes of this long word are comprised between 0x20 and 0x7f, it was later rewritten like this:
char p_secret1[] = "Tv!*";
This change makes the code more human-readable because many other secrets in the Apple DRMS protocol are ASCII strings. Also, I know how to look for binaries that use the string "Tv!*", but it takes me some more time to think of a way to find binaries that use 0x5476212A. And the Sony rootkit uses the following (only relevant lines shown):
 .text:100883B8   mov   cl, byte ptr ds:xxxxx+4 ; 0
 .text:100883C2   mov   eax, dword ptr ds:xxxxx ; "Tv!*"
 .text:100883C8   mov   [esp+70h+yyyyy], eax
 .text:100883DC   mov   [esp+7Ch+zzzzz], cl
The use of xxxxx+4 shows that ECDPlayerControl.ocx uses a string instead of a 32 bits integer to store the secret, disregarding the fact that the 5th character of the string (a null char) is never used. Another example: in this commit I reorganised the DoExtShuffle() function, merging FourthPass() and FifthPass() and discarding a structure allocated on the stack. What is important here is that DoExtShuffle() was built by a complex combination of choices, the main purpose of which being to reduce the size of the C functions:
 static void DoExtShuffle( uint32_t * p_bordel )
  
     uint32_t i_ret;
     i_ret = FirstPass( p_bordel );
     SecondPass( p_bordel, i_ret );
     ThirdPass( p_bordel );
     FourthPass( p_bordel );
  
Note how i_ret is not reused and could be merged into the p_bordel array, or maybe SecondPass() merged into FirstPass(). This choice is definitely a legacy of how the code evolved. And the Sony equivalent: a perfect match.
 .text:10089F3C xxxxx:
 .text:10089F3C   mov   ecx, esi
 .text:10089F3E   call  yyyyy
 .text:10089F43   push  eax
 .text:10089F44   mov   eax, esi
 .text:10089F46   call  zzzzz
 .text:10089F4B   add   esp, 4
 .text:10089F4E   call  ttttt
 .text:10089F53   call  uuuuu
After having studied the Sony code for a while, I have of course gathered dozens of such examples. But I also discovered a few new things. Where does the DRMS code come from? The code undoubtedly comes originally from VLC, but it has traveled a lot. I would be surpried if it came directly from VLC, as no other part of VLC is included with the rootkit. And although there are parts of FAAC in the Sony code and FAAC includes VLC s drms.c, the version currently in the FAAC CVS is horribly outdated. Sebastian Porst also noticed a few obvious differences between the Sony code and the version of drms.c present in VLC. The most obvious being this one:
 if( p_shuffle->i_version == 0x01000300 )
  
     DoExtShuffle( p_bordel );
  
Which became:
 .text:10089F2E   cmp   eax, 1000300h
 .text:10089F33   jz    short DoExtShuffle
 .text:10089F35   cmp   eax, 1000400h
 .text:10089F3A   jnz   short skip
 .text:10089F3C DoExtShuffle:
 .text:10089F3C   ...
 .text:10089F58 skip:
 .text:10089F58   ...
That 0x01000400 is a version check for 4th generation iPods firmwares. I also discovered at least 40 KB of new lookup tables that seem to be used for more buffer shuffling. At first I thought it was simply F4I s DRM implementation, but the shuffling calls are nested with iPod hardware information retrieval from our DRMS code, so they re really part of drms.c. Sony distributing a DRMSv3 descrambler? The only explanation I can think of is that someone took the VLC code, added support for an upcoming Apple DRMS format version and redistributed the software without letting the VLC authors know, probably violating the GPL (I only say that because I have not found the software yet, but I feel pretty safe in saying it). Since it is based on GPL software, I was already entitled to ask Sony for the source code of ECDPlayerControl.ocx. But as the copyright holder of a significant part of the software they counterfeited, maybe I have a greater chance of being heard. Not that it would be difficult to reverse-engineer it yet another time, but it would be awesome if the next opensource iTunes Music Store file player was contributed by Sony!

Erich Schubert: What SSH scanners try to do

I've been recently investigating a poorly maintained box (granted, it was just a workstation used for surfing the web) which was behaving oddly. In fact you could not longer login via SSH. I quickly noticed that there was a non-working sshd on it, in /usr/local/bin. So I thought - why would a badly maintained box have a non-standard SSH on it? This made me very suspicious, so I immedeately ran chkrootkit. It didn't find anything except it told me that someone had tampered with the wtmp file. The "tampering dates" aligned with the creation times of the ssh. A quick "find" run came up with the tool to do so, too. A quick check in the logfiles - which were fine, since they were not standard syslog, probably - showed that a SSH scanner had managed to login into an unprivileged account with a weak password, then used a kernel exploit from january to gain root privileges. Apparently he was unsatisfied with the sshd on the box, so he tried to put a different version on it, which, well, didn't work and he could no longer logon to the box himself. A rootkit was apparently not yet installed (verified after a clean boot), he was just about to setup his own sshd... maybe he had noticed that the box was just a stupid surfing box and then didn't care enough to cover his tracks (or just shoot himself in the foot by breaking the sshd) So if you are running boxes on the internet: (PHP guys: yes, I know that there are some good PHP scripts. But there are tons of badly written ones, too... and PHP is a major intrusion vector, and the privilege escalation I've seen here would have worked just fine with a PHP installation not using safe mode and safe_mode_exec_dir) A firewall I maintain at our university has been tracking ssh connections using the recent match for quite some time, and a nice side effect is that it reduces all their "spam" in your logs, too (in case you bother to read them. Do at least read the logcheck results!)

21 November 2005

Sam Hocevar: Finding a specific instance of a given day in the month in PHP

Andrew: to work out the fourth Thursday of the month, use this instead:
function nth_day($instance, $dow, $month, $year)

  $first_dom = date("w", mktime(0, 0, 0, $month, 1, $year));
  return 1 + ((7 + $dow - $first_dom) % 7) + 7 * ($instance - 1);
Or, using Zeller s rule and avoiding function calls:
function nth_day($instance, $dow, $month, $year)

  if($month < 3) $year--; $D = $year % 100; $C = (int)($year / 100); $m = 1 + (($month + 9) % 12);
  $f = 1 + (int)((13 * $m - 1) / 5) + $D + (int)($D / 4) + (int)($C / 4) - 2 * $C;
  $first_dom = $f % 7;
  return 1 + ((7 + $dow - $first_dom) % 7) + 7 * ($instance - 1);
Update: thanks to Andrew for spotting the error in the second version. Due to my misunderstanding of a hack in Zeller s rule, I had forgotten to decrease the year when the month was January or February. Also, PHP was not doing proper integer divisions and I had to cast results back to int despite all operands being ints.

Brett Parker: Hmm... It appears that I have a random quirk...

Maybe it's not just me, though... Does anyone else get upset with people that don't put DVDs/CDs back in there cases after use? The usual list of excuses being "I didn't know where the case was", or "Erm, yeah, I was going to do that". I don't mind them being left in players/drives, that's fine, you can generally find them, and they're not in danger of having coffee/tea spilt on them, or randomly getting lost... what really winds me up, though, is them being left on the corner of units, or put back in different boxes. OK - so having read that, definately I'm weird :)

Erich Schubert: Are social network services worth a dime?

Social network services (Wikipedia) such as Friendster, Linkedin, OpenBC are one of the top "web 2.0" hypes. I'm very sceptical about them, because I don't see the real benefits for me. (I'm referring to the pure "keep contact with your schoolmates" thing, not stuff which does much more such as serious blogging - e.g. livejournal - or planets such as planet.debian) The typical use case I've heard is much like "Imagine you have made a cool product, and want to sell it to some company. Now you can search for people at that company you know (or a friend of yours knows) and call them, this will help you get a feet in the door", as well as "you can use it for finding a job". I think that's bullshit, and to a large extend because I'd neither be willing to update my information in these services all the time, nor would I be willing to help just everybody here - most likely I'd just delete and ignore the email, and be really annoyed by a call (I'm annoyed by calls anyway)... It's not that I despise social networking per se. But I despise quantity instead of quality. I care a lot for my friends, and I'm in several groups grown around some technical issues; when someone is looking for a job I pay attention for suiteable offers around me; if someone needs something else I do try to help. But I'll only do that for people I'd really call friends. If you just want a quantitative number, last I checked my ranking was #36 in the global PGP keyring, meaning I have the 36th shortest average distance worldwide to verify a cryptographical key. So what? Of course I also tried one of the social networing services given above, joined a group for a university I was at. Even before the adminstrator of that group added me, I got an "invitation" by one "linkaholic". I rejected it, and even considered to report it as "spam" to the operator. I did indeed know that person, but all we had was a flamewar on a mailinglist, and I found him highly unsympatic. So why should I add him to my network? Where are the benefits for me (except that I'll maybe get an annoying call sometime in the future, when I could have forgotten about him)? No, in my opinion this social networking hype is built entirely on a hype, basically saying "look how well-connected I am, everybody knows me, and I know everybody", even when these relationships are only present on the computer, without anything worth being called a "relationship" behind. The flame-war I mentioned earlier was btw. on the topic of Resume/CV books. Which are even worse than this social networking thing, IMHO.

Next.

Previous.