mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Fixed memory leak caused by certificate dialogs.
Ticket 1054
This commit is contained in:
parent
154ed91457
commit
80f497a889
@ -78,39 +78,27 @@ IPA.cert.get_dialog = function(spec) {
|
|||||||
|
|
||||||
spec = spec || {};
|
spec = spec || {};
|
||||||
|
|
||||||
var that = {};
|
var that = IPA.dialog(spec);
|
||||||
|
|
||||||
|
that.width = spec.width || 500;
|
||||||
|
that.height = spec.height || 400;
|
||||||
|
|
||||||
that.title = spec.title || '';
|
|
||||||
that.usercertificate = spec.usercertificate || '';
|
that.usercertificate = spec.usercertificate || '';
|
||||||
|
|
||||||
var dialog = $('<div/>', {
|
that.add_button(IPA.messages.buttons.close, function() {
|
||||||
'title': that.title
|
that.close();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
that.create = function() {
|
||||||
var textarea = $('<textarea/>', {
|
var textarea = $('<textarea/>', {
|
||||||
readonly: 'yes',
|
readonly: 'yes',
|
||||||
style: 'width: 100%; height: 275px;'
|
style: 'width: 100%; height: 275px;'
|
||||||
}).appendTo(dialog);
|
}).appendTo(that.container);
|
||||||
|
|
||||||
textarea.val(
|
textarea.val(
|
||||||
IPA.cert.BEGIN_CERTIFICATE+'\n'+
|
IPA.cert.BEGIN_CERTIFICATE+'\n'+
|
||||||
that.usercertificate+'\n'+
|
that.usercertificate+'\n'+
|
||||||
IPA.cert.END_CERTIFICATE);
|
IPA.cert.END_CERTIFICATE);
|
||||||
|
|
||||||
that.open = function() {
|
|
||||||
|
|
||||||
var buttons = {};
|
|
||||||
|
|
||||||
buttons[IPA.messages.buttons.close] = function() {
|
|
||||||
dialog.dialog('destroy');
|
|
||||||
};
|
|
||||||
|
|
||||||
dialog.dialog({
|
|
||||||
modal: true,
|
|
||||||
width: 500,
|
|
||||||
height: 400,
|
|
||||||
buttons: buttons
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return that;
|
return that;
|
||||||
@ -120,16 +108,29 @@ IPA.cert.revoke_dialog = function(spec) {
|
|||||||
|
|
||||||
spec = spec || {};
|
spec = spec || {};
|
||||||
|
|
||||||
var that = {};
|
var that = IPA.dialog(spec);
|
||||||
|
|
||||||
|
that.width = spec.width || 500;
|
||||||
|
that.height = spec.height || 300;
|
||||||
|
|
||||||
that.title = spec.title || '';
|
|
||||||
that.revoke = spec.revoke;
|
that.revoke = spec.revoke;
|
||||||
|
|
||||||
var dialog = $('<div/>', {
|
that.add_button(IPA.messages.buttons.revoke, function() {
|
||||||
'title': that.title
|
var values = {};
|
||||||
|
values['reason'] = that.select.val();
|
||||||
|
if (that.revoke) {
|
||||||
|
that.revoke(values);
|
||||||
|
}
|
||||||
|
that.close();
|
||||||
});
|
});
|
||||||
|
|
||||||
var table = $('<table/>').appendTo(dialog);
|
that.add_button(IPA.messages.buttons.cancel, function() {
|
||||||
|
that.close();
|
||||||
|
});
|
||||||
|
|
||||||
|
that.create = function() {
|
||||||
|
|
||||||
|
var table = $('<table/>').appendTo(that.container);
|
||||||
|
|
||||||
var tr = $('<tr/>').appendTo(table);
|
var tr = $('<tr/>').appendTo(table);
|
||||||
|
|
||||||
@ -146,38 +147,14 @@ IPA.cert.revoke_dialog = function(spec) {
|
|||||||
|
|
||||||
td = $('<td/>').appendTo(tr);
|
td = $('<td/>').appendTo(tr);
|
||||||
|
|
||||||
var select = $('<select/>').appendTo(td);
|
that.select = $('<select/>').appendTo(td);
|
||||||
for (var i=0; i<IPA.cert.CRL_REASON.length; i++) {
|
for (var i=0; i<IPA.cert.CRL_REASON.length; i++) {
|
||||||
if (!IPA.cert.CRL_REASON[i]) continue;
|
if (!IPA.cert.CRL_REASON[i]) continue;
|
||||||
$('<option/>', {
|
$('<option/>', {
|
||||||
'value': i,
|
'value': i,
|
||||||
'html': IPA.cert.CRL_REASON[i]
|
'html': IPA.cert.CRL_REASON[i]
|
||||||
}).appendTo(select);
|
}).appendTo(that.select);
|
||||||
}
|
}
|
||||||
|
|
||||||
that.open = function() {
|
|
||||||
|
|
||||||
var buttons = {};
|
|
||||||
|
|
||||||
buttons[IPA.messages.buttons.revoke] = function() {
|
|
||||||
var values = {};
|
|
||||||
values['reason'] = select.val();
|
|
||||||
if (that.revoke) {
|
|
||||||
that.revoke(values);
|
|
||||||
}
|
|
||||||
dialog.dialog('destroy');
|
|
||||||
};
|
|
||||||
|
|
||||||
buttons[IPA.messages.buttons.cancel] = function() {
|
|
||||||
dialog.dialog('destroy');
|
|
||||||
};
|
|
||||||
|
|
||||||
dialog.dialog({
|
|
||||||
modal: true,
|
|
||||||
width: 500,
|
|
||||||
height: 300,
|
|
||||||
buttons: buttons
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return that;
|
return that;
|
||||||
@ -187,40 +164,28 @@ IPA.cert.restore_dialog = function(spec) {
|
|||||||
|
|
||||||
spec = spec || {};
|
spec = spec || {};
|
||||||
|
|
||||||
var that = {};
|
var that = IPA.dialog(spec);
|
||||||
|
|
||||||
|
that.width = spec.width || 400;
|
||||||
|
that.height = spec.height || 200;
|
||||||
|
|
||||||
that.title = spec.title || '';
|
|
||||||
that.restore = spec.restore;
|
that.restore = spec.restore;
|
||||||
|
|
||||||
var dialog = $('<div/>', {
|
that.add_button(IPA.messages.buttons.restore, function() {
|
||||||
'title': that.title
|
|
||||||
});
|
|
||||||
|
|
||||||
dialog.append(
|
|
||||||
IPA.messages.objects.cert.restore_confirmation);
|
|
||||||
|
|
||||||
that.open = function() {
|
|
||||||
|
|
||||||
var buttons = {};
|
|
||||||
|
|
||||||
buttons[IPA.messages.buttons.restore] = function() {
|
|
||||||
var values = {};
|
var values = {};
|
||||||
if (that.restore) {
|
if (that.restore) {
|
||||||
that.restore(values);
|
that.restore(values);
|
||||||
}
|
}
|
||||||
dialog.dialog('destroy');
|
that.close();
|
||||||
};
|
|
||||||
|
|
||||||
buttons[IPA.messages.buttons.cancel] = function() {
|
|
||||||
dialog.dialog('destroy');
|
|
||||||
};
|
|
||||||
|
|
||||||
dialog.dialog({
|
|
||||||
modal: true,
|
|
||||||
width: 400,
|
|
||||||
height: 200,
|
|
||||||
buttons: buttons
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
that.add_button(IPA.messages.buttons.cancel, function() {
|
||||||
|
that.close();
|
||||||
|
});
|
||||||
|
|
||||||
|
that.create = function() {
|
||||||
|
that.container.append(
|
||||||
|
IPA.messages.objects.cert.restore_confirmation);
|
||||||
};
|
};
|
||||||
|
|
||||||
return that;
|
return that;
|
||||||
@ -230,9 +195,11 @@ IPA.cert.view_dialog = function(spec) {
|
|||||||
|
|
||||||
spec = spec || {};
|
spec = spec || {};
|
||||||
|
|
||||||
var that = {};
|
var that = IPA.dialog(spec);
|
||||||
|
|
||||||
|
that.width = spec.width || 600;
|
||||||
|
that.height = spec.height || 500;
|
||||||
|
|
||||||
that.title = spec.title || '';
|
|
||||||
that.subject = IPA.cert.parse_dn(spec.subject);
|
that.subject = IPA.cert.parse_dn(spec.subject);
|
||||||
that.serial_number = spec.serial_number || '';
|
that.serial_number = spec.serial_number || '';
|
||||||
that.issuer = IPA.cert.parse_dn(spec.issuer);
|
that.issuer = IPA.cert.parse_dn(spec.issuer);
|
||||||
@ -241,11 +208,13 @@ IPA.cert.view_dialog = function(spec) {
|
|||||||
that.md5_fingerprint = spec.md5_fingerprint || '';
|
that.md5_fingerprint = spec.md5_fingerprint || '';
|
||||||
that.sha1_fingerprint = spec.sha1_fingerprint || '';
|
that.sha1_fingerprint = spec.sha1_fingerprint || '';
|
||||||
|
|
||||||
var dialog = $('<div/>', {
|
that.add_button(IPA.messages.buttons.close, function() {
|
||||||
'title': that.title
|
that.close();
|
||||||
});
|
});
|
||||||
|
|
||||||
var table = $('<table/>').appendTo(dialog);
|
that.create = function() {
|
||||||
|
|
||||||
|
var table = $('<table/>').appendTo(that.container);
|
||||||
|
|
||||||
var tr = $('<tr/>').appendTo(table);
|
var tr = $('<tr/>').appendTo(table);
|
||||||
$('<td/>', {
|
$('<td/>', {
|
||||||
@ -336,21 +305,6 @@ IPA.cert.view_dialog = function(spec) {
|
|||||||
$('<td/>', {
|
$('<td/>', {
|
||||||
'html': that.md5_fingerprint
|
'html': that.md5_fingerprint
|
||||||
}).appendTo(tr);
|
}).appendTo(tr);
|
||||||
|
|
||||||
that.open = function() {
|
|
||||||
|
|
||||||
var buttons = {};
|
|
||||||
|
|
||||||
buttons[IPA.messages.buttons.close] = function() {
|
|
||||||
dialog.dialog('destroy');
|
|
||||||
};
|
|
||||||
|
|
||||||
dialog.dialog({
|
|
||||||
modal: true,
|
|
||||||
width: 600,
|
|
||||||
height: 500,
|
|
||||||
buttons: buttons
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return that;
|
return that;
|
||||||
@ -360,36 +314,16 @@ IPA.cert.request_dialog = function(spec) {
|
|||||||
|
|
||||||
spec = spec || {};
|
spec = spec || {};
|
||||||
|
|
||||||
var that = {};
|
var that = IPA.dialog(spec);
|
||||||
|
|
||||||
|
that.width = spec.width || 500;
|
||||||
|
that.height = spec.height || 400;
|
||||||
|
|
||||||
that.title = spec.title || '';
|
|
||||||
that.request = spec.request;
|
that.request = spec.request;
|
||||||
|
|
||||||
var dialog = $('<div/>', {
|
that.add_button(IPA.messages.buttons.issue, function() {
|
||||||
'title': that.title
|
|
||||||
});
|
|
||||||
|
|
||||||
dialog.append(IPA.messages.objects.cert.enter_csr+':');
|
|
||||||
dialog.append('<br/>');
|
|
||||||
dialog.append('<br/>');
|
|
||||||
|
|
||||||
dialog.append(IPA.cert.BEGIN_CERTIFICATE_REQUEST);
|
|
||||||
dialog.append('<br/>');
|
|
||||||
|
|
||||||
var textarea = $('<textarea/>', {
|
|
||||||
style: 'width: 100%; height: 225px;'
|
|
||||||
}).appendTo(dialog);
|
|
||||||
|
|
||||||
dialog.append('<br/>');
|
|
||||||
dialog.append(IPA.cert.END_CERTIFICATE_REQUEST);
|
|
||||||
|
|
||||||
that.open = function() {
|
|
||||||
|
|
||||||
var buttons = {};
|
|
||||||
|
|
||||||
buttons[IPA.messages.buttons.issue] = function() {
|
|
||||||
var values = {};
|
var values = {};
|
||||||
var request = textarea.val();
|
var request = that.textarea.val();
|
||||||
request =
|
request =
|
||||||
IPA.cert.BEGIN_CERTIFICATE_REQUEST+'\n'+
|
IPA.cert.BEGIN_CERTIFICATE_REQUEST+'\n'+
|
||||||
$.trim(request)+'\n'+
|
$.trim(request)+'\n'+
|
||||||
@ -398,19 +332,27 @@ IPA.cert.request_dialog = function(spec) {
|
|||||||
if (that.request) {
|
if (that.request) {
|
||||||
that.request(values);
|
that.request(values);
|
||||||
}
|
}
|
||||||
dialog.dialog('destroy');
|
that.close();
|
||||||
};
|
|
||||||
|
|
||||||
buttons[IPA.messages.buttons.cancel] = function() {
|
|
||||||
dialog.dialog('destroy');
|
|
||||||
};
|
|
||||||
|
|
||||||
dialog.dialog({
|
|
||||||
modal: true,
|
|
||||||
width: 500,
|
|
||||||
height: 400,
|
|
||||||
buttons: buttons
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
that.add_button(IPA.messages.buttons.cancel, function() {
|
||||||
|
that.close();
|
||||||
|
});
|
||||||
|
|
||||||
|
that.create = function() {
|
||||||
|
that.container.append(IPA.messages.objects.cert.enter_csr+':');
|
||||||
|
that.container.append('<br/>');
|
||||||
|
that.container.append('<br/>');
|
||||||
|
|
||||||
|
that.container.append(IPA.cert.BEGIN_CERTIFICATE_REQUEST);
|
||||||
|
that.container.append('<br/>');
|
||||||
|
|
||||||
|
that.textarea = $('<textarea/>', {
|
||||||
|
style: 'width: 100%; height: 225px;'
|
||||||
|
}).appendTo(that.container);
|
||||||
|
|
||||||
|
that.container.append('<br/>');
|
||||||
|
that.container.append(IPA.cert.END_CERTIFICATE_REQUEST);
|
||||||
};
|
};
|
||||||
|
|
||||||
return that;
|
return that;
|
||||||
@ -703,6 +645,7 @@ IPA.cert.status_widget = function(spec) {
|
|||||||
'sha1_fingerprint': result['sha1_fingerprint']
|
'sha1_fingerprint': result['sha1_fingerprint']
|
||||||
});
|
});
|
||||||
|
|
||||||
|
dialog.init();
|
||||||
dialog.open();
|
dialog.open();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -725,6 +668,7 @@ IPA.cert.status_widget = function(spec) {
|
|||||||
'usercertificate': entity_certificate
|
'usercertificate': entity_certificate
|
||||||
});
|
});
|
||||||
|
|
||||||
|
dialog.init();
|
||||||
dialog.open();
|
dialog.open();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -755,6 +699,7 @@ IPA.cert.status_widget = function(spec) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
dialog.init();
|
||||||
dialog.open();
|
dialog.open();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -791,6 +736,7 @@ IPA.cert.status_widget = function(spec) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
dialog.init();
|
||||||
dialog.open();
|
dialog.open();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -823,6 +769,7 @@ IPA.cert.status_widget = function(spec) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
dialog.init();
|
||||||
dialog.open();
|
dialog.open();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,6 +36,7 @@ IPA.dialog = function(spec) {
|
|||||||
that._entity_name = spec.entity_name;
|
that._entity_name = spec.entity_name;
|
||||||
|
|
||||||
that.width = spec.width || '400px';
|
that.width = spec.width || '400px';
|
||||||
|
that.height = spec.height;
|
||||||
|
|
||||||
that.buttons = {};
|
that.buttons = {};
|
||||||
|
|
||||||
@ -173,7 +174,11 @@ IPA.dialog = function(spec) {
|
|||||||
*/
|
*/
|
||||||
that.open = function(container) {
|
that.open = function(container) {
|
||||||
|
|
||||||
that.container = $('<div/>').appendTo(container);
|
that.container = $('<div/>');
|
||||||
|
|
||||||
|
if (container) {
|
||||||
|
container.append(that.container);
|
||||||
|
}
|
||||||
|
|
||||||
if (that.template) {
|
if (that.template) {
|
||||||
var template = IPA.get_template(that.template);
|
var template = IPA.get_template(that.template);
|
||||||
|
Loading…
Reference in New Issue
Block a user