Skip to content

Commit 73976e9

Browse files
author
0cyn
committed
Re-add license text field to API
1 parent f389b25 commit 73976e9

6 files changed

Lines changed: 16 additions & 1 deletion

File tree

binaryninjaapi.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19201,6 +19201,7 @@ namespace BinaryNinja {
1920119201
std::string GetPluginDirectory() const;
1920219202
std::string GetAuthor() const;
1920319203
std::string GetDescription() const;
19204+
std::string GetLicenseText() const;
1920419205
std::string GetName() const;
1920519206
std::vector<PluginType> GetPluginTypes() const;
1920619207
std::string GetPackageUrl() const;

binaryninjacore.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7970,6 +7970,7 @@ extern "C"
79707970
BINARYNINJACOREAPI char** BNPluginGetApis(BNPlugin* p, size_t* count);
79717971
BINARYNINJACOREAPI const char* BNPluginGetAuthor(BNPlugin* p);
79727972
BINARYNINJACOREAPI const char* BNPluginGetDescription(BNPlugin* p);
7973+
BINARYNINJACOREAPI const char* BNPluginGetLicenseText(BNPlugin* p);
79737974
BINARYNINJACOREAPI BNVersionInfo BNPluginGetMinimumVersionInfo(BNPlugin* p);
79747975
BINARYNINJACOREAPI BNVersionInfo BNPluginGetMaximumVersionInfo(BNPlugin* p);
79757976
BINARYNINJACOREAPI BNVersionInfo BNParseVersionString(const char* v);

pluginmanager.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,11 @@ string Extension::GetDescription() const
7070
RETURN_STRING(BNPluginGetDescription(m_object));
7171
}
7272

73+
string Extension::GetLicenseText() const
74+
{
75+
RETURN_STRING(BNPluginGetLicenseText(m_object));
76+
}
77+
7378
static VersionInfo ConvertVersionInfo(const BNVersionInfo& coreInfo)
7479
{
7580
VersionInfo result;

python/pluginmanager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ def description(self) -> Optional[str]:
154154
@deprecation.deprecated(deprecated_in="5.3", details='This field will be removed.')
155155
def license_text(self) -> Optional[str]:
156156
"""String complete license text for the given plugin"""
157-
return ''
157+
return core.BNPluginGetLicenseText(self.handle)
158158

159159
@property
160160
def long_description(self) -> Optional[str]:

rust/src/repository/plugin.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,13 @@ impl Extension {
103103
unsafe { BnString::into_string(result as *mut c_char) }
104104
}
105105

106+
/// String complete license text for the given plugin
107+
pub fn license_text(&self) -> String {
108+
let result = unsafe { BNPluginGetLicenseText(self.handle.as_ptr()) };
109+
assert!(!result.is_null());
110+
unsafe { BnString::into_string(result as *mut c_char) }
111+
}
112+
106113
/// Minimum version info the plugin was tested on
107114
pub fn minimum_version_info(&self) -> VersionInfo {
108115
let result = unsafe { BNPluginGetMinimumVersionInfo(self.handle.as_ptr()) };

rust/tests/repository.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ fn test_list() {
2020
for plugin in &plugins {
2121
let plugin_path = plugin.path();
2222
let plugin_by_path = repository.plugin_by_path(&plugin_path).unwrap();
23+
let _license_text = plugin.license_text();
2324
assert_eq!(plugin.package_url(), plugin_by_path.package_url());
2425
}
2526
}

0 commit comments

Comments
 (0)