Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Patch that disables Subsonic license checking and validation

Update: Go to this repository to find a maintained fork of Subsonic without the licensing. This other repository is another fork and has more followers.

A patch to disable the licensing functionality in Subsonic, a GPL-licensed media streaming server/web interface. Use of the mobile apps requires you to get a license after 30 days of trial. You obtain a license via donation.

Except that's not a donation. So, here's a patch to fix that. Support the Subsonic project with a donation that's actually a donation. The program is developed and maintained very well.

Steps to victory

svn co https://subsonic.svn.sourceforge.net/svnroot/subsonic/trunk subsonic

Check out a different branch if you want a specific version.

From the branch root:

patch -p0 < nolicense.patch
mvn install
cd subsonic-booter/
mvn install

Replace the downloaded subsonic.war and subsonic-booter-with-dependencies.jar with the newly compiled ones. Compilation of subsonic-booter is probably optional. It's just a precaution in case the branch you are compiling is newer than whatever version you downloaded.

Index: subsonic-main/src/main/java/net/sourceforge/subsonic/service/SettingsService.java
===================================================================
--- subsonic-main/src/main/java/net/sourceforge/subsonic/service/SettingsService.java (revision 2462)
+++ subsonic-main/src/main/java/net/sourceforge/subsonic/service/SettingsService.java (working copy)
@@ -589,10 +589,7 @@
}
public boolean isLicenseValid(String email, String license) {
- if (email == null || license == null) {
- return false;
- }
- return license.equalsIgnoreCase(StringUtil.md5Hex(email.toLowerCase()));
+ return true;
}
public String getDownsamplingCommand() {
@@ -1136,31 +1133,7 @@
}
private void validateLicense() {
- String email = getLicenseEmail();
- Date date = getLicenseDate();
-
- if (email == null || date == null) {
- licenseValidated = false;
- return;
- }
-
licenseValidated = true;
-
- HttpClient client = new DefaultHttpClient();
- HttpConnectionParams.setConnectionTimeout(client.getParams(), 120000);
- HttpConnectionParams.setSoTimeout(client.getParams(), 120000);
- HttpGet method = new HttpGet("http://subsonic.org/backend/validateLicense.view" + "?email=" + email +
- "&date=" + date.getTime() + "&version=" + versionService.getLocalVersion());
- try {
- ResponseHandler<String> responseHandler = new BasicResponseHandler();
- String content = client.execute(method, responseHandler);
- licenseValidated = content != null && content.contains("true");
- LOG.debug("License validated: " + licenseValidated);
- } catch (Throwable x) {
- LOG.warn("Failed to validate license.", x);
- } finally {
- client.getConnectionManager().shutdown();
- }
}
public void validateLicenseAsync() {
@ProjectMoon

This comment has been minimized.

Copy link
Owner Author

commented Feb 3, 2012

The instructions assume you are on a Unix command line. You will need Maven and SVN installed. It's a list of commands you need to enter. This can be done under Windows as well. You will still need all the dependencies. If you don't understand the instructions, I suggest you read up on using Subversion and Maven on the Windows command line.

@OakRaider4Life

This comment has been minimized.

Copy link

commented Feb 12, 2012

When patching I got the errors "Hunk #1 failed at 589" and "Hunk #2 failed at 1136." Pulled down the nolicense.patch from the git clone URL and the subsonic directory from the subversion url as directed.. am I missing something here?

@ProjectMoon

This comment has been minimized.

Copy link
Owner Author

commented Feb 13, 2012

http://www.markusbe.com/2009/11/how-to-apply-a-patch-and-solve-hunk-failed-cant-find-file-to-patch-and-others/#hunk-failed

The file has probably changed since this patch was created. I don't remember the specific commit I checked out. But really all you need to do is set licenseValidated to true, and return true from isLicenseValid.

@OakRaider4Life

This comment has been minimized.

Copy link

commented Feb 13, 2012

Is there a different file I need to edit if I'm trying to compile for an ubuntu server?

@OakRaider4Life

This comment has been minimized.

Copy link

commented Feb 14, 2012

Ok, what I did to successfully make this patch work on an Ubuntu Server:

Find lines of code pointed to in patch, in file specified by patch (/subsonic-main/src/main/java/net/sourceforge/subsonic/service/SettingsService.java) and make changes specified by ProjectMoon (also specified in code of patch). Follow instructions to compile as described in readme, then
cd [SUBSONIC ROOT]/subsonic-installer-debian
mvn install

This will compile a new subsonic.war and subsonic-booter-jar-with-dependencies.jar in [SUBSONIC ROOT]/subsonic-installer-debian/target/deb/usr/share/subsonic
Copy the .war (and .jar if needed) to /usr/share/subsonic, run
/etc/init.d/subsonic restart
and server is patched.

@ProjectMoon

This comment has been minimized.

Copy link
Owner Author

commented Feb 14, 2012

If you know what commit you checked out, you can submit a new patch and I can specify the commit in the gist.

@EugeneKay

This comment has been minimized.

Copy link

commented Mar 4, 2012

I am maintaining a git-svn checkout of the Subsonic project here with the licensing code removed, similar to this patch. I have released a .war, and will be making a best effort to keep up-to-date with release versions.

@jonathanebetts

This comment has been minimized.

Copy link

commented Mar 5, 2012

Thank you SO much EugeneKay ... I was wondering why people wouldn't just fork this software into something that didn't contain the license checking and my searches led me here. Now ..... how would a non-programmer go about compiling your new fork to a working version of subsonic-4.6-setup.exe (i.e. windows) ..... ? I'm no slacker, but have no clue how to turn a set of files on github into compiled java software ..... Any hints? Thanks!

@ProjectMoon

This comment has been minimized.

Copy link
Owner Author

commented Mar 5, 2012

Instructions would be the same as they are in this gist, minus the part about applying the patch. You need to install maven and then do mvn install on the root of the repository and in the subsonic-booter subproject.

@ProjectMoon

This comment has been minimized.

Copy link
Owner Author

commented Mar 5, 2012

Also, just randomly found this: http://forum.subsonic.org/forum/viewtopic.php?f=3&t=3521&start=15

Edit: Ok, apparently this is another fork. See the GitHub repo here: https://github.com/Mach5/supersonic

That one already has 16 followers.

@EugeneKay

This comment has been minimized.

Copy link

commented Mar 5, 2012

I was not aware of that fork, but they appear to be doing quite a bit of rebranding and modification. I'm unsure what effect that will have on the end product, but I happen to like the lil yellow submarine logo. The license on this code is GPL v3, with none of the Section 7 terms being applied, which would restrict said branding. I nevertheless will be making some effort to indicate that this is not a subsonic.org release, on the Downloads page I will be putting up and in the About page in the software.

I will do what I can to get some more formats built & uploaded today - I put up the .war because that's what I use(I have an existing Tomcat6 server).

@oktane

This comment has been minimized.

Copy link

commented Aug 30, 2012

so I had no luck with replacing the WAR, nor finding a complete supersonic download, and I do not think that recompiling the thing every time, not to mention setting up the development environment, is an easy thing for most non-dev people. The simplest solution for me was to fool the license check via a hosts DNS redirect to a local (or remote) server that serves up /backend/validateLicense.view, and returns true.

A killer solution would be to integrate this hack into subsonic itself, by placing the file into installdir/jetty/3081/webapp (varies I think) so that it's own server would serve it up, then just applying the dns change via whatever means. (local HOSTS file on server, router, dnsmasq) But I couldn't get that to work, since if a GET is made for a .view file on subsonic's jetty, it does it's java function lookup instead of delivering the file. (lookup fails since there is no backend classes obviously) Does anyone know any jetty voodoo like similar to an apache redirect, which could be installed by simply placing a file in that jetty 'server-root' folder? For now, I just used a different server to host the file, and it validates the license check fine. (success is donation link/heart goes away) But it would be nice if the solution was all in one, more elegant I suppose.

Note that this kills the following (fairly useless) features: remote settings storage, new version alerts, etc.. that DNS redirect will prevent all phoning home.

Cheers, from a person that would donate if they could.

@Rovanion

This comment has been minimized.

Copy link

commented Sep 22, 2012

Here's a current diff for upstream version 4.7 of Subsonic: https://gist.github.com/3767624

@f7n

This comment has been minimized.

Copy link

commented Jun 4, 2013

I can't get this to work. I've installed subsonic from source in my home dir ~/subsonic, I make a file in this dir called noLicence.patch and run the commands, but I get "Hunk #1 Failed [...]" errors. How can I fix this?

@EugeneKay

This comment has been minimized.

Copy link

commented Sep 8, 2015

In case anybody is still encountering this Gist on Google, please note that there have been recent changes to licensing code which invalidates this patch entirely. My Fork is the only one I'm aware of that is keeping current with upstream Subsonic and does not add bells+whistles.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.