src/com
by Noriko Hosoi
src/com/netscape/admin/dirserv/panel/RestorePanel.java | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
New commits:
commit 2b45ed8b705b70ee4860892622cee3faec6b7bcc
Author: Noriko Hosoi <nhosoi(a)jiji.usersys.redhat.com>
Date: Mon Feb 7 18:25:05 2011 -0800
Bug 387981 - plain files can be chosen on the Restore Directory dialog
https://bugzilla.redhat.com/show_bug.cgi?id=387981
Description: This patch adds 2 checks to RestorePanel:
if the restore path exists or not and
if the path is a directory or not.
When both are true, the OK button is enabled.
diff --git a/src/com/netscape/admin/dirserv/panel/RestorePanel.java b/src/com/netscape/admin/dirserv/panel/RestorePanel.java
index d510506..9198a9e 100644
--- a/src/com/netscape/admin/dirserv/panel/RestorePanel.java
+++ b/src/com/netscape/admin/dirserv/panel/RestorePanel.java
@@ -250,7 +250,14 @@ public class RestorePanel extends BlankPanel {
if (_tfExport.getText().trim().equals("")) {
setOkay(false);
} else {
- setOkay(true);
+ File f = new File(_tfExport.getText());
+ if (!f.exists()) { // Restore path must exist
+ setOkay(false);
+ } else if (!f.isDirectory()) { // Restore path must be a directory
+ setOkay(false);
+ } else {
+ setOkay(true);
+ }
}
}
13 years, 3 months
lib/libdsa
by Noriko Hosoi
lib/libdsa/dsalib_confs.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
New commits:
commit a9085ef0baae4c6a6997aa2c9b795c7ebac827d2
Author: Noriko Hosoi <nhosoi(a)jiji.usersys.redhat.com>
Date: Mon Feb 7 18:14:21 2011 -0800
Bug 387981 - plain files can be chosen on the Restore Directory dialog
https://bugzilla.redhat.com/show_bug.cgi?id=387981
Description: dsalib_ldif_parse_line: OpenLDAP ldif_read_record
takes buffer with its length and resizes it if it internally
requires more memory. The function dsalib_ldif_parse_line did
not properly initialize the address and the size which caused
the memory problem and crashed some CGIs such as ds_listdb.
This patch initializes the address and size to 0.
diff --git a/lib/libdsa/dsalib_confs.c b/lib/libdsa/dsalib_confs.c
index c7049bc..3e4380d 100644
--- a/lib/libdsa/dsalib_confs.c
+++ b/lib/libdsa/dsalib_confs.c
@@ -55,8 +55,8 @@ dsalib_ldif_parse_line(
rc = ldif_parse_line(line, &type->bv_val, &value->bv_val, &vlen);
type->bv_len = type->bv_val ? strlen(type->bv_val) : 0;
value->bv_len = vlen;
- *freeval = 0; /* always returns in place */
#endif
+ *freeval = 0; /* always returns in place */
return rc;
}
@@ -77,7 +77,7 @@ ds_get_conf_from_file(FILE *conf)
char *entry = 0;
int lineno = 0;
#if defined(USE_OPENLDAP)
- int buflen;
+ int buflen = 0;
#endif
#if defined(USE_OPENLDAP)
@@ -118,6 +118,8 @@ ds_get_conf_from_file(FILE *conf)
}
}
free(begin);
+ entry = NULL;
+ buflen = 0;
}
return(conf_list);
13 years, 3 months
console/src/com/netscape/management/client/ug ResEditorPosixGpMembers.java, NONE, 1.1 ResEditorPosixGroup.java, NONE, 1.1 PickerEditorResource.properties, 1.4, 1.5
by Nathan Kinder
Author: nkinder
Update of /cvs/dirsec/console/src/com/netscape/management/client/ug
In directory cvs01.phx2.fedoraproject.org:/tmp/cvs-serv19832/src/com/netscape/management/client/ug
Modified Files:
PickerEditorResource.properties
Added Files:
ResEditorPosixGpMembers.java ResEditorPosixGroup.java
Log Message:
Bug 668950 - Add posixGroup support to Console
This adds UI to the users and groups tab to allow posix group attributes
to be set when creating or modifying a group.
--- NEW FILE ResEditorPosixGpMembers.java ---
/** BEGIN COPYRIGHT BLOCK
* Copyright (C) 2001 Sun Microsystems, Inc. Used by permission.
* Copyright (C) 2010 Red Hat, Inc.
* All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation version
* 2.1 of the License.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
* END COPYRIGHT BLOCK **/
package com.netscape.management.client.ug;
import java.awt.*;
import java.util.*;
import java.awt.event.*;
import com.netscape.management.client.console.ConsoleInfo;
import com.netscape.management.client.util.*;
import com.netscape.management.nmclf.*;
import netscape.ldap.*;
import javax.swing.*;
import javax.swing.event.*;
import javax.swing.text.*;
import javax.swing.border.*;
/**
* ResEditorPosixGpMembers is a plugin for the ResourceEditor. It is used
* when editing group membership information. This page lets administrators
* define the group membership statically, assigning specific users to the
* group.
*
* @see IResourceEditorPage
* @see ResourceEditor
* @see ResEditorGroupMembers
*/
public class ResEditorPosixGpMembers extends JPanel implements IResourceEditorPage,
Observer, ActionListener, IRPCallBack {
static final String ATTR_MEMBER_UID = "memberuid";
static final String ATTR_UID = "uid";
PickerEditorResourceSet _resource = new PickerEditorResourceSet();
private String ID;
VLDirectoryTable _groupMembers;
boolean _isModified = false;
boolean _isReadOnly = false;
boolean _isEnable = true;
JButton _addUser, _removeUser;
ConsoleInfo _consoleInfo;
JFrame _parent;
Vector delMembers = new Vector();
Vector addMembers = new Vector();
ResourcePageObservable _observable;
/**
* Constructor
*
* @param info session information
* @param parent parent frame
*/
public ResEditorPosixGpMembers(ConsoleInfo info, JFrame parent) {
super(true);
_consoleInfo = info;
_parent = parent;
ID = _resource.getString("PosixGroupMember", "ID");
Hashtable map = new Hashtable();
String cn = "cn"; // Default values in case info is unavailable
String cnLabel = "Member Name";
String uid = "uid";
String uidLabel = "Member User ID";
String cnColumnInfo =
_resource.getString("staticGroupMember", "cnColumnInfo");
String uidColumnInfo =
_resource.getString("staticGroupMember", "uidColumnInfo");
int index = cnColumnInfo.indexOf(',');
if (index != -1) {
cn = cnColumnInfo.substring(0, index);
cnLabel = cnColumnInfo.substring(index + 1);
}
index = uidColumnInfo.indexOf(',');
if (uidColumnInfo.indexOf(',') != -1) {
uid = uidColumnInfo.substring(0, index);
uidLabel = uidColumnInfo.substring(index + 1);
}
map.put(cn, cnLabel);
map.put(uid, uidLabel);
Vector header = new Vector();
header.addElement(cn);
header.addElement(uid);
_groupMembers = new VLDirectoryTable(map, header);
_groupMembers.setConsoleInfo(info);
_groupMembers.setTableColumnWidth(0, 100);
_addUser = new JButton(_resource.getString("groupMember", "addButton"));
_addUser.setToolTipText(_resource.getString("staticGroupMember", "add_tt"));
_addUser.addActionListener(this);
_removeUser = new JButton(_resource.getString("groupMember", "removeButton"));
_removeUser.setToolTipText(_resource.getString("staticGroupMember", "remove_tt"));
_removeUser.addActionListener(this);
JButtonFactory.resizeGroup(_addUser, _removeUser);
Box buttonBox = new Box(BoxLayout.X_AXIS);
buttonBox.add(Box.createHorizontalGlue());
buttonBox.add(_addUser);
buttonBox.add( Box.createHorizontalStrut(
SuiLookAndFeel.SEPARATED_COMPONENT_SPACE));
buttonBox.add(_removeUser);
setLayout(new GridBagLayout());
GridBagUtil.constrain(this, _groupMembers, 0, 0, 1, 1, 1.0,
1.0, GridBagConstraints.WEST, GridBagConstraints.BOTH,
SuiLookAndFeel.VERT_WINDOW_INSET,
SuiLookAndFeel.HORIZ_WINDOW_INSET, 0,
SuiLookAndFeel.HORIZ_WINDOW_INSET);
GridBagUtil.constrain(this, buttonBox, 0, 1, 1, 1, 0.0, 0.0,
GridBagConstraints.EAST, GridBagConstraints.NONE,
SuiLookAndFeel.SEPARATED_COMPONENT_SPACE,
SuiLookAndFeel.COMPONENT_SPACE,
SuiLookAndFeel.VERT_WINDOW_INSET,
SuiLookAndFeel.HORIZ_WINDOW_INSET);
}
void browseUidList(Vector uidList) {
LDAPConnection ldc = _consoleInfo.getUserLDAPConnection();
for (int i=0; i < uidList.size(); i++) {
String uid = (String)uidList.elementAt(i);
_groupMembers.doSearch(ldc,_consoleInfo.getUserBaseDN(),LDAPConnection.SCOPE_SUB,"uid="+uid);
}
}
/**
* Implements the IResourceEditorPage interface.
* Initializes the page with context information. It will be called once
* the page is added to resource editor.
*
* @param observable the observable object
* @param parent the resource editor container
*/
public void initialize(ResourcePageObservable observable,
ResourceEditor parent) {
_observable = observable;
Vector members = observable.get(ATTR_MEMBER_UID);
if (members != null && members.size() > 0) {
browseUidList(members);
}
}
/**
* Implements the Observer interface. Updates the fields when notified.
*
* @param o the observable object
* @param arg the attribute to update
*/
public void update(Observable o, Object arg) {
}
/**
* Implements the IRPCallBack interface. Adds the results
* to the table.
*
* @param vResult Vector of LDAPEntry objects
*/
public void getResults(Vector vResult) {
Debug.println("ResEditorPosixGroup.getResults: vResult = " + vResult);
for (int i = 0; i < vResult.size(); i++) {
LDAPEntry entry = (LDAPEntry)(vResult.elementAt(i));
try {
String uid = entry.getAttribute(ATTR_UID).getStringValues().nextElement().toString();
// Check if dn was deleted in this session
boolean previouslyDeleted = delMembers.removeElement(uid);
if (!previouslyDeleted) {
addMembers.addElement(uid);
}
_groupMembers.addRow(entry);
}catch (NullPointerException ex){
Debug.println("ResEditorPosixGpMemebers:getResults: uid not found: "+entry);
}
}
}
/**
* Implements the ActionListener interface.
*
* @param e the action event
*/
public void actionPerformed(ActionEvent e) {
if (e.getSource().equals(_addUser)) {
ResourcePickerDlg pickerDlg =
new ResourcePickerDlg(_consoleInfo, this, _parent);
pickerDlg.show();
pickerDlg.dispose();
} else if (e.getSource().equals(_removeUser)) {
int selections[] = _groupMembers.getSelectedRows();
for (int i = 0; i < selections.length; i++) {
LDAPEntry entry = _groupMembers.getRow(selections[i]);
try {
String uid = entry.getAttribute(ATTR_UID).getStringValues().nextElement().toString();
// Check if uid was added in this session
boolean previouslyAdded = addMembers.removeElement(uid);
if (!previouslyAdded) {
delMembers.addElement(uid);
}
}catch (NullPointerException ex){
Debug.println("ResEditorPosixGpMemebers:actionPerformed: uid not found: "+entry);
}
}
_groupMembers.deleteRows(selections);
}
}
/**
* Implements the IResourceEditorPage interface.
* Returns unique ID string which identifies the page.
*
* @return unique ID for the page
*/
public String getID() {
return ID;
}
/**
* Implements the IResourceEditorPage interface.
* Handle some post save condition. This is called after the
* information is saved and the object has been created in
* the directory server.
*
* @param observable the observable object
* @return true if save succeeded; false otherwise
* @exception Exception
*/
public boolean afterSave(ResourcePageObservable observable)
throws Exception {
return true;
}
/**
* Implements the IResourceEditorPage interface.
* Saves all modified information to the observable object
*
* @param observable the observable object
* @return true if save succeeded; false otherwise
* @exception Exception
*/
public boolean save(ResourcePageObservable observable)
throws Exception {
String _POSIXOBJECTCLASS = "posixgroup";
boolean isNewGroup = observable.isNewUser();// attrReplace == objectclass
int count = _groupMembers.getRowCount();
int modSize = delMembers.size() + addMembers.size();
Debug.println("ResEditorPosixGpMembers.save: observable =" + observable);
Debug.println("ResEditorPosixGpMembers.save: num mods = " + modSize);
if (modSize == 0) {
return true; // nothing to save
}
boolean oc_present = false;
try {
LDAPEntry entry = observable.getLDAPEntry(observable.getDN());
Enumeration attrVals = entry.getAttribute("objectclass").getStringValues();
while (attrVals.hasMoreElements()){
if (attrVals.nextElement().toString().equalsIgnoreCase(_POSIXOBJECTCLASS)){
oc_present = true;
}
}
} catch (NullPointerException ex) {
Debug.println("ResEditorPosixGpMembers.save: no entry: "+observable.getDN());
}
/**
* If (count < modSize), then it is more efficient to replace the
* whole members than to add/delete individual members.
*/
if (isNewGroup || (count < modSize) || !oc_present) {
if (count > 0) {
Vector vNewList = new Vector();
for (int i = 0; i < count; i++) {
LDAPEntry ldapEntry = (LDAPEntry)_groupMembers.getRow(i);
Debug.println("ResEditorPosixGpMembers.save: entry "+i+": "+ldapEntry);
vNewList.addElement(ldapEntry.getAttribute(ATTR_UID).getStringValues().nextElement());
}
observable.replace(ATTR_MEMBER_UID, vNewList);
}
else {
observable.delete(ATTR_MEMBER_UID);
}
}
else {
/**
* For updates, do not use a very inefficient observable to
* replace() the whole 'memberUid' attribute as it can be
* huge. Instead use own update logic to update only deltas.
*/
LDAPModificationSet mod = new LDAPModificationSet();
if (addMembers.size() > 0) {
LDAPAttribute addAttr = new LDAPAttribute(ATTR_MEMBER_UID);
for (int i=0; i< addMembers.size(); i++) {
String member = (String) addMembers.elementAt(i);
addAttr.addValue(member);
}
mod.add(LDAPModification.ADD, addAttr);
}
if (delMembers.size() > 0) {
LDAPAttribute delAttr = new LDAPAttribute(ATTR_MEMBER_UID);
for (int i=0; i< delMembers.size(); i++) {
String member = (String) delMembers.elementAt(i);
delAttr.addValue(member);
}
mod.add(LDAPModification.DELETE, delAttr);
}
LDAPConnection ldc = _consoleInfo.getUserLDAPConnection();
try {
if (Debug.isEnabled()) {
Debug.println("ResEditorPosixGpMembers.save: mod =" + mod);
}
ldc.modify(observable.getDN(), mod);
}
catch (LDAPException e) {
Debug.println("ResEditorPosixGpMembers.save : " + e);
throw e;
}
}
delMembers.removeAllElements();
addMembers.removeAllElements();
return true;
}
/**
* Implements the IResourceEditorPage interface.
* Clears all information on the page.
*/
public void clear() {}
/**
* Implements the IResourceEditorPage interface.
* Resets information on the page.
*/
public void reset() {
}
/**
* Implements the IResourceEditorPage interface.
* Sets default information on the page.
*/
public void setDefault() {}
/**
* Implements the IResourceEditorPage interface.
* Specifies whether any information on the page has been modified.
*
* @return true if some information has been modified; false otherwise
*/
public boolean isModified() {
return _isModified;
}
/**
* Implements the IResourceEditorPage interface.
* Sets the modified flag for the page.
*
* @param value true or false
*/
public void setModified(boolean value) {
_isModified = value;
}
/**
* Implements the IResourceEditorPage interface.
* Specifies whether the information on the page is read only.
*
* @return true if some information has been modified; false otherwise
*/
public boolean isReadOnly() {
return _isReadOnly;
}
/**
* Implements the IResourceEditorPage interface.
* Sets the read only flag for the page.
*
* @param value true or false
*/
public void setReadOnly(boolean value) {
_isReadOnly = value;
}
/**
* Implements the IResourceEditorPage interface.
* Sets the enabled flag for the page.
*
* @param value true or false
*/
public void setEnable(boolean value) {
_isEnable = value;
}
/**
* Implements the IResourceEditorPage interface.
* Specifies whether all required information has been provided for
* the page.
*
* @return true if all required information has been provided; false otherwise
*/
public boolean isComplete() {
return true;
}
/**
* Implements the IResourceEditorPage interface.
* Returns a brief name for the page. The name should reflect the
* plugin page.
*/
public String getDisplayName() {
return ID;
}
/**
* Implements the IResourceEditorPage interface.
* Displays help information for the page
*/
public void help() {
}
}
--- NEW FILE ResEditorPosixGroup.java ---
/** BEGIN COPYRIGHT BLOCK
* Copyright (C) 2001 Sun Microsystems, Inc. Used by permission.
* Copyright (C) 2010 Red Hat, Inc.
* All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation version
* 2.1 of the License.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
* END COPYRIGHT BLOCK **/
package com.netscape.management.client.ug;
import java.util.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.border.*;
import netscape.ldap.*;
import com.netscape.management.client.console.*;
import com.netscape.management.client.util.*;
import com.netscape.management.nmclf.*;
/**
* ResEditorPosixGroup is a plugin for the ResourceEditor. It is used
* when editing Posix group information.
*
* @see IResourceEditorPage
* @see ResourceEditor
*/
public class ResEditorPosixGroup extends JPanel implements IResourceEditorPage,
Observer {
public static String _POSIXOBJECTCLASS="posixgroup";
public static String _GIDNUMBER="gidnumber";
public static String _MEMBERUID="memberuid";
PickerEditorResourceSet _resource = new PickerEditorResourceSet();
private String ID;
boolean _enableModified; // A flag if _cbEnable was modified
JCheckBox _cbEnable;
JTextField _tfGIDNumber;
String _oldGIDNumber;
boolean _isModified = false;
boolean _isReadOnly = false;
boolean _isEnable = true;
ResourceEditor _resourceEditor;
ResEditorPosixGpMembers posixGroup;
ConsoleInfo _info;
ResourcePageObservable _observable;
private Vector componentVector = new Vector();
/**
* Used to notify the ResourcePageObservable when a value has changed.
* Note that this updates all observers.
*/
FocusAdapter _focusAdaptor = new FocusAdapter() {
public void focusLost(FocusEvent e) {
// 550649 Chinese locale: If a focus is lost because the
// window is no more active, do not update observable. Do it
// only when another components in the same window gets focus.
Window w = (Window) SwingUtilities.getAncestorOfClass(Window.class, ResEditorPosixGroup.this);
if(w != null && w.getFocusOwner() == null) {
return;
}
if (_observable == null) {
return;
}
Component src = e.getComponent();
if (src==_tfGIDNumber)
{
_observable.replace(_GIDNUMBER, _tfGIDNumber.getText());
}
}
};
ActionListener enableActionListener = new ActionListener()
{
public void actionPerformed(ActionEvent ev)
{
_enableModified = true;
boolean state = _cbEnable.isSelected();
Enumeration e = componentVector.elements();
while(e.hasMoreElements())
{
JComponent c = (JComponent)e.nextElement();
c.setEnabled(state);
}
}
};
/**
* Constructor
*/
public ResEditorPosixGroup() {
super(true);
}
/**
* Implements the IResourceEditorPage interface.
* Initializes the page with context information. It will be called once
* the page is added to resource editor.
*
* @param observable the observable object
* @param parent the resource editor container
*/
public void initialize(ResourcePageObservable observable,
ResourceEditor parent) {
ID = _resource.getString("PosixGroup", "ID");
_resourceEditor = parent;
_observable = observable;
_info = observable.getConsoleInfo();
posixGroup = new ResEditorPosixGpMembers(
_resourceEditor.getConsoleInfo(), parent.getFrame());
posixGroup.initialize(observable, parent);
JLabel infoLabel = new JLabel(_resource.getString("userPage","required"));
JLabel jlGIDNumber = new JLabel( _resource.getString("Posix", "gidNumber"), SwingConstants.RIGHT);
JLabel blankLabel = new JLabel(""); // Prevents components of this panel from centering
componentVector.addElement(infoLabel);
componentVector.addElement(jlGIDNumber);
_cbEnable = new JCheckBox(_resource.getString("PosixGroup","enable"));
_tfGIDNumber = new JTextField();
jlGIDNumber.setLabelFor(_tfGIDNumber);
componentVector.addElement(_tfGIDNumber);
componentVector.addElement(posixGroup);
_cbEnable.addActionListener(enableActionListener);
_tfGIDNumber.addFocusListener(_focusAdaptor);
JPanel p = new JPanel(new GridBagLayout());
GridBagUtil.constrain(p, _cbEnable, 0, 0, GridBagConstraints.REMAINDER, 1, 0.0,
0.0, GridBagConstraints.NORTHWEST,
GridBagConstraints.HORIZONTAL,
SuiLookAndFeel.VERT_WINDOW_INSET,
SuiLookAndFeel.HORIZ_WINDOW_INSET, 0, 0);
GridBagUtil.constrain(p, jlGIDNumber, 0, 1, 1, 1, 0.0, 0.0,
GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL,
SuiLookAndFeel.VERT_WINDOW_INSET,
SuiLookAndFeel.HORIZ_WINDOW_INSET, 0, 0);
GridBagUtil.constrain(p, _tfGIDNumber, 1, 1,
GridBagConstraints.REMAINDER, 1, 1.0, 0.0,
GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL,
SuiLookAndFeel.VERT_WINDOW_INSET,
SuiLookAndFeel.DIFFERENT_COMPONENT_SPACE, 0,
SuiLookAndFeel.HORIZ_WINDOW_INSET);
GridBagUtil.constrain(p, posixGroup, 1, 2,
GridBagConstraints.REMAINDER, 1, 1.0, 0.0,
GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL,
SuiLookAndFeel.VERT_WINDOW_INSET,
SuiLookAndFeel.DIFFERENT_COMPONENT_SPACE, 0,
SuiLookAndFeel.HORIZ_WINDOW_INSET);
GridBagUtil.constrain(p, infoLabel, 1, 3,
GridBagConstraints.REMAINDER, 1, 1.0, 0.0,
GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL,
SuiLookAndFeel.VERT_WINDOW_INSET,
SuiLookAndFeel.HORIZ_WINDOW_INSET, 0,
SuiLookAndFeel.HORIZ_WINDOW_INSET);
GridBagUtil.constrain(p, blankLabel, 0, 4,
GridBagConstraints.REMAINDER,
GridBagConstraints.REMAINDER, 1.0, 1.0,
GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH,
SuiLookAndFeel.COMPONENT_SPACE,
SuiLookAndFeel.HORIZ_WINDOW_INSET,
SuiLookAndFeel.VERT_WINDOW_INSET,
SuiLookAndFeel.HORIZ_WINDOW_INSET);
JScrollPane sp = new JScrollPane(p);
sp.setBorder(null);
setLayout(new BorderLayout());
add("Center", sp);
// set up the value
Vector valueVector = observable.get("objectclass");
_cbEnable.setSelected(true);
for (int i=0; i< valueVector.size();i++){
if (valueVector.get(i).toString().equalsIgnoreCase(_POSIXOBJECTCLASS)){
_cbEnable.setSelected(false);
}
}
_cbEnable.doClick();
_enableModified = false;
_oldGIDNumber = observable.get(_GIDNUMBER, 0);
_tfGIDNumber.setText(_oldGIDNumber);
}
/**
* Implements the Observer interface. Updates the fields when notified.
*
* @param o the observable object
* @param arg the attribute to update
*/
public void update(Observable o, Object arg) {
Debug.println("ResEditorPosixGroup.update: arg = " + arg);
posixGroup.update(o,arg);
if ((o instanceof ResourcePageObservable) == false) {
return;
}
ResourcePageObservable observable = (ResourcePageObservable) o;
if (arg instanceof String) {
String argString = (String) arg;
if (argString.equalsIgnoreCase(_GIDNUMBER)) {
_tfGIDNumber.setText(observable.get(_GIDNUMBER, 0));
}
}
}
/**
* Implements the IResourceEditorPage interface.
* Returns unique ID string which identifies the page.
*
* @return unique ID for the page
*/
public String getID() {
return ID;
}
/**
* Implements the IResourceEditorPage interface.
* Handle some post save condition. This is called after the
* information is saved and the object has been created in
* the directory server.
*
* @param observable the observable object
* @return true if save succeeded; false otherwise
* @exception Exception
*/
public boolean afterSave(ResourcePageObservable observable)
throws Exception {
return true;
}
/**
* Implements the IResourceEditorPage interface.
* Saves all modified information to the observable object
*
* @param observable the observable object
* @return true if save succeeded; false otherwise
* @exception Exception
*/
public boolean save(ResourcePageObservable observable)
throws Exception {
Debug.println("ResEditorPosixGroup.save: observable = " + observable);
if(_cbEnable.isSelected())
{
Debug.println("ResEditorPosixGroup.save: _cbEnable.isSelected");
Vector valueVector = observable.get("objectclass");
boolean oc_present = false;
for (int i=0; i< valueVector.size();i++){
if (valueVector.get(i).toString().equalsIgnoreCase(_POSIXOBJECTCLASS)){
oc_present = true;
}
}
if (!oc_present) {
valueVector.addElement(_POSIXOBJECTCLASS);
observable.replace("objectclass", valueVector);
}
String sGIDNumber=_tfGIDNumber.getText();
if (sGIDNumber.equals(_oldGIDNumber)==false)
{
observable.replace(_GIDNUMBER,sGIDNumber);
}
posixGroup.save(observable);
}
else
{
Debug.println("ResEditorPosixGroup.save: !_cbEnable.isSelected");
Vector valueVector = observable.get("objectclass");
if(valueVector.contains(_POSIXOBJECTCLASS))
valueVector.removeElement(_POSIXOBJECTCLASS);
observable.replace("objectclass", valueVector);
observable.delete(_GIDNUMBER, "");
observable.delete(_MEMBERUID, "");
return true;
}
return true;
}
/**
* Implements the IResourceEditorPage interface.
* Clears all information on the page.
*/
public void clear() {}
/**
* Implements the IResourceEditorPage interface.
* Resets information on the page.
*/
public void reset() {
/*
_groupName.setText("");
_groupDescription.setText("");
*/
}
/**
* Implements the IResourceEditorPage interface.
* Sets default information on the page.
*/
public void setDefault() {}
/**
* Implements the IResourceEditorPage interface.
* Specifies whether any information on the page has been modified.
*
* @return true if some information has been modified; false otherwise
*/
public boolean isModified() {
return _isModified;
}
/**
* Implements the IResourceEditorPage interface.
* Sets the modified flag for the page.
*
* @param value true or false
*/
public void setModified(boolean value) {
_isModified = value;
}
/**
* Implements the IResourceEditorPage interface.
* Specifies whether the information on the page is read only.
*
* @return true if some information has been modified; false otherwise
*/
public boolean isReadOnly() {
return _isReadOnly;
}
/**
* Implements the IResourceEditorPage interface.
* Sets the read only flag for the page.
*
* @param value true or false
*/
public void setReadOnly(boolean value) {
_isReadOnly = value;
}
/**
* Implements the IResourceEditorPage interface.
* Sets the enabled flag for the page.
*
* @param value true or false
*/
public void setEnable(boolean value) {
_isEnable = value;
}
/**
* Implements the IResourceEditorPage interface.
* Specifies whether all required information has been provided for
* the page.
*
* @return true if all required information has been provided; false otherwise
*/
public boolean isComplete() {
if (_cbEnable.isSelected()) {
if (_tfGIDNumber.getText().trim().length()==0) {
SuiOptionPane.showMessageDialog(null,
_resource.getString("resourceEditor", "IncompleteText"),
_resource.getString("resourceEditor",
"IncompleteTitle"), SuiOptionPane.ERROR_MESSAGE);
ModalDialogUtil.sleep();
return false;
}
int testval;
try {
testval = Integer.parseInt(_tfGIDNumber.getText().trim());
} catch (NumberFormatException nfe) {
SuiOptionPane.showMessageDialog(null,
_resource.getString("resourceEditor", "GidNotANumberText"),
_resource.getString("resourceEditor",
"GidNotANumberTitle"), SuiOptionPane.ERROR_MESSAGE);
ModalDialogUtil.sleep();
return false;
}
if (testval < 0) {
SuiOptionPane.showMessageDialog(null,
_resource.getString("resourceEditor", "GidNotValidText"),
_resource.getString("resourceEditor",
"GidNotValidTitle"), SuiOptionPane.ERROR_MESSAGE);
ModalDialogUtil.sleep();
return false;
}
if (testval == 0) {
Object[] val1 = {_resource.getString("resourceEditor", "yesButton"),
_resource.getString("resourceEditor", "noButton")};
Object[] msg1 = {_resource.getString("resourceEditor", "errorText1"),
_resource.getString("resourceEditor", "errorText2"),
_resource.getString("resourceEditor", "errorText3")};
int selection = SuiOptionPane.showOptionDialog(null, msg1,
_resource.getString("resourceEditor", "errorTitle"),
SuiOptionPane.DEFAULT_OPTION,
SuiOptionPane.WARNING_MESSAGE, null, val1, val1[0]);
if (selection == 1) {
ModalDialogUtil.sleep();
return false;
}
}
}
return true;
}
/**
* Implements the IResourceEditorPage interface.
* Returns a brief name for the page. The name should reflect the
* plugin page.
*/
public String getDisplayName() {
return ID;
}
/**
* Implements the IResourceEditorPage interface.
* Displays help information for the page
*/
public void help() {
Help help = new Help(_resource);
help.contextHelp("ug","ResEditorPosixGroup");
}
}
Index: PickerEditorResource.properties
===================================================================
RCS file: /cvs/dirsec/console/src/com/netscape/management/client/ug/PickerEditorResource.properties,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- PickerEditorResource.properties 16 Dec 2008 23:32:01 -0000 1.4
+++ PickerEditorResource.properties 8 Feb 2011 17:00:09 -0000 1.5
@@ -270,6 +270,14 @@
Posix-loginShell=Login Shell:
Posix-Gecos=Gecos:
+#
+# posix group page
+#
+PosixGroup-enable=Enable Posix Group Attributes
+PosixGroup-ID=Posix Group
+PosixGroup-memberUid=Member UID's:
+PosixGroupMember-ID=Posix Group Members
+
# Resource Editor Group Members Page
groupMember-ID=Members
@@ -440,6 +448,8 @@
ug-ResEditorPosixUser=admin
ug-AdvancedSearch=admin
ug-BasicSearch=admin
+ug-ResEditorPosixGroup=admin
+ug-ResEditorPosixGpMembers=admin
#
# language list
13 years, 3 months
admserv/schema
by Nathan Kinder
admserv/schema/ldif/02globalpreferences.ldif.tmpl | 10 ++++++++++
1 file changed, 10 insertions(+)
New commits:
commit 1392e7d3724b5e4e14bceba299e1cb1622ddf15c
Author: Nathan Kinder <nkinder(a)redhat.com>
Date: Mon Feb 7 15:57:40 2011 -0800
Bug 668950 - Add posix group support to Console
This updates the NetscapeRoot tree to allow Console to support
the new posixGroup UI. The tree will be updated properly for
both new and upgraded config DS instances.
diff --git a/admserv/schema/ldif/02globalpreferences.ldif.tmpl b/admserv/schema/ldif/02globalpreferences.ldif.tmpl
index 941906b..636bb2c 100644
--- a/admserv/schema/ldif/02globalpreferences.ldif.tmpl
+++ b/admserv/schema/ldif/02globalpreferences.ldif.tmpl
@@ -149,6 +149,15 @@ nsClassname: com.netscape.management.client.ug.LanguagePage
nsmerge: {nsclassname}MULTI_MERGE
dn: cn=groupofuniquenames,cn=ResourceEditorExtension,ou=%console_version%,ou=Admin,ou=Global Preferences,ou=%domain%,o=NetscapeRoot
+changetype: modify
+replace: nsClassname
+nsClassname: com.netscape.management.client.ug.ResEditorGroupInfo
+nsClassname: com.netscape.management.client.ug.ResEditorGroupMembers
+nsClassname: com.netscape.management.client.ug.ResEditorAccountPage
+nsClassname: com.netscape.management.client.ug.LanguagePage
+nsClassname: com.netscape.management.client.ug.ResEditorPosixGroup
+
+dn: cn=groupofuniquenames,cn=ResourceEditorExtension,ou=%console_version%,ou=Admin,ou=Global Preferences,ou=%domain%,o=NetscapeRoot
cn: groupofuniquenames
objectClass: nsResourceRef
objectClass: nsAdminResourceEditorExtension
@@ -159,6 +168,7 @@ nsClassname: com.netscape.management.client.ug.ResEditorGroupInfo
nsClassname: com.netscape.management.client.ug.ResEditorGroupMembers
nsClassname: com.netscape.management.client.ug.ResEditorAccountPage
nsClassname: com.netscape.management.client.ug.LanguagePage
+nsClassname: com.netscape.management.client.ug.ResEditorPosixGroup
nsmerge: {nsclassname}MULTI_MERGE
dn: cn=organizationalunit,cn=ResourceEditorExtension,ou=%console_version%,ou=Admin,ou=Global Preferences,ou=%domain%,o=NetscapeRoot
13 years, 3 months
help/en
by Nathan Kinder
help/en/help/create_group_posix_group.html | 19 +++++++++++++++++++
help/en/tokens.map | 1 +
2 files changed, 20 insertions(+)
New commits:
commit 4ffc63b5f913f97f4cbd4c4665939d877c8fb781
Author: Nathan Kinder <nkinder(a)redhat.com>
Date: Mon Feb 7 15:55:55 2011 -0800
Bug 668950 - Add posix group support to Console
This adds the online help for the new posix group UI that is
being added to the idm-console framework. All of the framework
help is implemented here.
diff --git a/help/en/help/create_group_posix_group.html b/help/en/help/create_group_posix_group.html
new file mode 100644
index 0000000..954e856
--- /dev/null
+++ b/help/en/help/create_group_posix_group.html
@@ -0,0 +1,19 @@
+<p class="topic">
+Create Group - Posix Group
+</p>
+
+<p class="text">
+Use this panel to store Posix/UNIX-specific group entries in the directory.
+</p>
+<p class="text">
+<b>Enable Posix Group Attributes.</b> Check this box to enable the fields in this panel.
+</p>
+<p class="text">
+<b>GID Number.</b> Enter the group's UNIX group ID number.
+</p>
+<p class="text">
+<b>Add.</b> Displays the Search form, which you can use to locate users and groups. Once you have added users, click OK for the change to take effect.
+</p>
+<p class="text">
+<b>Remove.</b> Deletes the selected entry from this group.
+</p>
diff --git a/help/en/tokens.map b/help/en/tokens.map
index 0f87069..a9cea8f 100644
--- a/help/en/tokens.map
+++ b/help/en/tokens.map
@@ -87,6 +87,7 @@ dynamicQueryConstructor-help = help/construct_ldap_url.html
ug-ResEditorCertGroupMembers = help/create_group_members_certificates_group.html
ug-ResEditorCertGroupMembersEditDlg = help/certificates_group.html
ug-ResEditorGroupPageLangWP = help/create_group_languages.html
+ug-ResEditorPosixGroup = help/create_group_posix_group.html
;CREATE ORGANIZATIONAL UNIT
ug-OUPageDef = help/create_organizational_unit.html
13 years, 3 months
Branch '389-ds-base-1.2.8' - ldap/servers
by Noriko Hosoi
ldap/servers/plugins/usn/usn.c | 44 ++++++++++++++++++++++++++++-
ldap/servers/slapd/back-ldbm/ldbm_delete.c | 37 +++++++++++++++++++-----
ldap/servers/slapd/slapi-plugin.h | 1
3 files changed, 74 insertions(+), 8 deletions(-)
New commits:
commit e87f58129506ac92425b0240a7863e680dcd56e4
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Mon Feb 7 11:18:54 2011 -0800
Bug 675265 - preventryusn gets added to entries on a failed delete
https://bugzilla.redhat.com/show_bug.cgi?id=675265
Description: When an entry is deleted with Entry USN plugin enabled,
an operational attribute preventryusn is added to handle indexes and
entryusn tombstone. The attribute must have been added only when
the delete was successful, but it was added regardless of the result
from the operation. This patch checks the delete result in the
newly added entryusn delete bepost plugin (usn_bepostop_delete).
If it is not successful, the bepost plugin cleans up the attribute.
diff --git a/ldap/servers/plugins/usn/usn.c b/ldap/servers/plugins/usn/usn.c
index 4ad9e66..792ea47 100644
--- a/ldap/servers/plugins/usn/usn.c
+++ b/ldap/servers/plugins/usn/usn.c
@@ -59,6 +59,7 @@ static int usn_bepreop_add(Slapi_PBlock *pb);
static int usn_bepreop_delete(Slapi_PBlock *pb);
static int usn_bepreop_modify(Slapi_PBlock *pb);
static int usn_bepostop(Slapi_PBlock *pb);
+static int usn_bepostop_delete (Slapi_PBlock *pb);
static int usn_start(Slapi_PBlock *pb);
static int usn_close(Slapi_PBlock *pb);
static int usn_get_attr(Slapi_PBlock *pb, const char* type, void *value);
@@ -177,7 +178,7 @@ usn_bepostop_init(Slapi_PBlock *pb)
if (slapi_pblock_set(pb, SLAPI_PLUGIN_BE_POST_ADD_FN,
(void *)usn_bepostop) != 0 ||
slapi_pblock_set(pb, SLAPI_PLUGIN_BE_POST_DELETE_FN,
- (void *)usn_bepostop) != 0 ||
+ (void *)usn_bepostop_delete) != 0 ||
slapi_pblock_set(pb, SLAPI_PLUGIN_BE_POST_MODIFY_FN,
(void *)usn_bepostop) != 0 ||
slapi_pblock_set(pb, SLAPI_PLUGIN_BE_POST_MODRDN_FN,
@@ -516,6 +517,47 @@ bail:
return rc;
}
+/* count up the counter */
+/* if the op is delete and the op was not successful, remove preventryusn */
+static int
+usn_bepostop_delete (Slapi_PBlock *pb)
+{
+ int rc = -1;
+ Slapi_Backend *be = NULL;
+
+ slapi_log_error(SLAPI_LOG_TRACE, USN_PLUGIN_SUBSYSTEM,
+ "--> usn_bepostop\n");
+
+ /* if op is not successful, don't increment the counter */
+ slapi_pblock_get(pb, SLAPI_RESULT_CODE, &rc);
+ if (LDAP_SUCCESS != rc) {
+ Slapi_Entry *e = NULL;
+
+ slapi_pblock_get(pb, SLAPI_DELETE_BEPOSTOP_ENTRY, &e);
+ if (NULL == e) {
+ rc = LDAP_NO_SUCH_OBJECT;
+ goto bail;
+ }
+ /* okay to return the rc from slapi_entry_delete_values */
+ rc = slapi_entry_delete_values(e, SLAPI_ATTR_ENTRYUSN_PREV, NULL);
+ goto bail;
+ }
+
+ slapi_pblock_get(pb, SLAPI_BACKEND, &be);
+ if (NULL == be) {
+ rc = LDAP_PARAM_ERROR;
+ goto bail;
+ }
+
+ if (be->be_usn_counter) {
+ slapi_counter_increment(be->be_usn_counter);
+ }
+bail:
+ slapi_log_error(SLAPI_LOG_TRACE, USN_PLUGIN_SUBSYSTEM,
+ "<-- usn_bepostop\n");
+ return rc;
+}
+
/* mimic replication to turn on create_tombstone_entry */
static int
usn_get_attr(Slapi_PBlock *pb, const char* type, void *value)
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_delete.c b/ldap/servers/slapd/back-ldbm/ldbm_delete.c
index f2454be..dc759b4 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_delete.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_delete.c
@@ -116,6 +116,7 @@ ldbm_back_delete( Slapi_PBlock *pb )
if (NULL == addr)
{
+ /* retval is -1 */
goto error_return;
}
ldap_result_code = slapi_dn_syntax_check(pb, addr->dn, 1);
@@ -123,6 +124,7 @@ ldbm_back_delete( Slapi_PBlock *pb )
{
ldap_result_code = LDAP_INVALID_DN_SYNTAX;
slapi_pblock_get(pb, SLAPI_PB_RESULT_TEXT, &ldap_result_message);
+ /* retval is -1 */
goto error_return;
}
@@ -158,19 +160,22 @@ ldbm_back_delete( Slapi_PBlock *pb )
operation->o_status = SLAPI_OP_STATUS_WILL_COMPLETE;
}
if ( slapi_op_abandoned( pb ) ) {
+ /* retval is -1 */
goto error_return;
}
/* find and lock the entry we are about to modify */
if ( (e = find_entry2modify( pb, be, addr, NULL )) == NULL )
{
- ldap_result_code= -1;
+ ldap_result_code= LDAP_NO_SUCH_OBJECT;
+ /* retval is -1 */
goto error_return; /* error result sent by find_entry2modify() */
}
if ( slapi_entry_has_children( e->ep_entry ) )
{
ldap_result_code= LDAP_NOT_ALLOWED_ON_NONLEAF;
+ /* retval is -1 */
goto error_return;
}
@@ -194,6 +199,7 @@ ldbm_back_delete( Slapi_PBlock *pb )
{
/* restore original entry so the front-end delete code can free it */
slapi_pblock_set( pb, SLAPI_DELETE_BEPREOP_ENTRY, orig_entry );
+ /* retval is -1 */
goto error_return;
}
slapi_pblock_set(pb, SLAPI_RESULT_CODE, &ldap_result_code);
@@ -211,6 +217,7 @@ ldbm_back_delete( Slapi_PBlock *pb )
slapi_pblock_get(pb, SLAPI_RESULT_CODE, &ldap_result_code);
/* restore original entry so the front-end delete code can free it */
slapi_pblock_set( pb, SLAPI_DELETE_BEPREOP_ENTRY, orig_entry );
+ /* retval is -1 */
goto error_return;
}
/* the flag could be set in a preop plugin (e.g., USN) */
@@ -294,6 +301,7 @@ ldbm_back_delete( Slapi_PBlock *pb )
if ( ldap_result_code != LDAP_SUCCESS )
{
ldap_result_message= errbuf;
+ /* retval is -1 */
goto error_return;
}
@@ -766,8 +774,7 @@ ldbm_back_delete( Slapi_PBlock *pb )
}
if (entryrdn_get_switch()) /* subtree-rename: on */
{
- retval =
- entryrdn_index_entry(be, e, BE_INDEX_DEL, &txn);
+ retval = entryrdn_index_entry(be, e, BE_INDEX_DEL, &txn);
if (DB_LOCK_DEADLOCK == retval) {
LDAPDebug0Args( LDAP_DEBUG_ARGS,
"delete (deleting entryrdn) DB_LOCK_DEADLOCK\n");
@@ -852,6 +859,7 @@ ldbm_back_delete( Slapi_PBlock *pb )
/* Failed */
LDAPDebug( LDAP_DEBUG_ANY, "Retry count exceeded in delete\n", 0, 0, 0 );
ldap_result_code= LDAP_OPERATIONS_ERROR;
+ retval = -1;
goto error_return;
}
@@ -885,6 +893,7 @@ ldbm_back_delete( Slapi_PBlock *pb )
ldap_result_code= LDAP_OPERATIONS_ERROR;
LDAPDebug( LDAP_DEBUG_ANY,
"ldbm_back_delete: modify_switch_entries failed\n", 0, 0, 0);
+ retval = -1;
goto error_return;
}
}
@@ -893,10 +902,6 @@ ldbm_back_delete( Slapi_PBlock *pb )
goto common_return;
error_return:
- if (e!=NULL) {
- cache_unlock_entry( &inst->inst_cache, e );
- CACHE_RETURN( &inst->inst_cache, &e );
- }
if (tombstone_in_cache)
{
CACHE_REMOVE( &inst->inst_cache, tombstone );
@@ -941,9 +946,27 @@ common_return:
* but not if the operation is purging tombstones.
*/
if (!delete_tombstone_entry) {
+ if (e) {
+ /* set entry in case be-postop plugins need to work on it
+ * (e.g., USN) */
+ slapi_pblock_get( pb, SLAPI_DELETE_BEPOSTOP_ENTRY, &orig_entry );
+ slapi_pblock_set( pb, SLAPI_DELETE_BEPOSTOP_ENTRY, e->ep_entry );
+ }
plugin_call_plugins (pb, SLAPI_PLUGIN_BE_POST_DELETE_FN);
+ /* set original entry back */
+ if (e) {
+ slapi_pblock_set( pb, SLAPI_DELETE_BEPOSTOP_ENTRY, orig_entry );
+ }
}
+ /* Need to return to cache after post op plugins are called */
+ if (retval) { /* error case */
+ if (e) {
+ cache_unlock_entry( &inst->inst_cache, e );
+ CACHE_RETURN( &inst->inst_cache, &e );
+ }
+ }
+
if (ruv_c_init) {
modify_term(&ruv_c, be);
}
diff --git a/ldap/servers/slapd/slapi-plugin.h b/ldap/servers/slapd/slapi-plugin.h
index 81db71f..dd601ca 100644
--- a/ldap/servers/slapd/slapi-plugin.h
+++ b/ldap/servers/slapd/slapi-plugin.h
@@ -5931,6 +5931,7 @@ typedef struct slapi_plugindesc {
#define SLAPI_DELETE_EXISTING_ENTRY SLAPI_ADD_EXISTING_DN_ENTRY
#define SLAPI_DELETE_GLUE_PARENT_ENTRY SLAPI_ADD_PARENT_ENTRY
#define SLAPI_DELETE_BEPREOP_ENTRY SLAPI_ENTRY_PRE_OP
+#define SLAPI_DELETE_BEPOSTOP_ENTRY SLAPI_ENTRY_POST_OP
/* modify arguments */
#define SLAPI_MODIFY_TARGET SLAPI_TARGET_DN
13 years, 3 months
ldap/servers
by Noriko Hosoi
ldap/servers/plugins/usn/usn.c | 44 ++++++++++++++++++++++++++++-
ldap/servers/slapd/back-ldbm/ldbm_delete.c | 37 +++++++++++++++++++-----
ldap/servers/slapd/slapi-plugin.h | 1
3 files changed, 74 insertions(+), 8 deletions(-)
New commits:
commit 10f6c0e14b52db8e5eaa73016456f41ede9702e6
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Mon Feb 7 11:18:54 2011 -0800
Bug 675265 - preventryusn gets added to entries on a failed delete
https://bugzilla.redhat.com/show_bug.cgi?id=675265
Description: When an entry is deleted with Entry USN plugin enabled,
an operational attribute preventryusn is added to handle indexes and
entryusn tombstone. The attribute must have been added only when
the delete was successful, but it was added regardless of the result
from the operation. This patch checks the delete result in the
newly added entryusn delete bepost plugin (usn_bepostop_delete).
If it is not successful, the bepost plugin cleans up the attribute.
diff --git a/ldap/servers/plugins/usn/usn.c b/ldap/servers/plugins/usn/usn.c
index 4ad9e66..792ea47 100644
--- a/ldap/servers/plugins/usn/usn.c
+++ b/ldap/servers/plugins/usn/usn.c
@@ -59,6 +59,7 @@ static int usn_bepreop_add(Slapi_PBlock *pb);
static int usn_bepreop_delete(Slapi_PBlock *pb);
static int usn_bepreop_modify(Slapi_PBlock *pb);
static int usn_bepostop(Slapi_PBlock *pb);
+static int usn_bepostop_delete (Slapi_PBlock *pb);
static int usn_start(Slapi_PBlock *pb);
static int usn_close(Slapi_PBlock *pb);
static int usn_get_attr(Slapi_PBlock *pb, const char* type, void *value);
@@ -177,7 +178,7 @@ usn_bepostop_init(Slapi_PBlock *pb)
if (slapi_pblock_set(pb, SLAPI_PLUGIN_BE_POST_ADD_FN,
(void *)usn_bepostop) != 0 ||
slapi_pblock_set(pb, SLAPI_PLUGIN_BE_POST_DELETE_FN,
- (void *)usn_bepostop) != 0 ||
+ (void *)usn_bepostop_delete) != 0 ||
slapi_pblock_set(pb, SLAPI_PLUGIN_BE_POST_MODIFY_FN,
(void *)usn_bepostop) != 0 ||
slapi_pblock_set(pb, SLAPI_PLUGIN_BE_POST_MODRDN_FN,
@@ -516,6 +517,47 @@ bail:
return rc;
}
+/* count up the counter */
+/* if the op is delete and the op was not successful, remove preventryusn */
+static int
+usn_bepostop_delete (Slapi_PBlock *pb)
+{
+ int rc = -1;
+ Slapi_Backend *be = NULL;
+
+ slapi_log_error(SLAPI_LOG_TRACE, USN_PLUGIN_SUBSYSTEM,
+ "--> usn_bepostop\n");
+
+ /* if op is not successful, don't increment the counter */
+ slapi_pblock_get(pb, SLAPI_RESULT_CODE, &rc);
+ if (LDAP_SUCCESS != rc) {
+ Slapi_Entry *e = NULL;
+
+ slapi_pblock_get(pb, SLAPI_DELETE_BEPOSTOP_ENTRY, &e);
+ if (NULL == e) {
+ rc = LDAP_NO_SUCH_OBJECT;
+ goto bail;
+ }
+ /* okay to return the rc from slapi_entry_delete_values */
+ rc = slapi_entry_delete_values(e, SLAPI_ATTR_ENTRYUSN_PREV, NULL);
+ goto bail;
+ }
+
+ slapi_pblock_get(pb, SLAPI_BACKEND, &be);
+ if (NULL == be) {
+ rc = LDAP_PARAM_ERROR;
+ goto bail;
+ }
+
+ if (be->be_usn_counter) {
+ slapi_counter_increment(be->be_usn_counter);
+ }
+bail:
+ slapi_log_error(SLAPI_LOG_TRACE, USN_PLUGIN_SUBSYSTEM,
+ "<-- usn_bepostop\n");
+ return rc;
+}
+
/* mimic replication to turn on create_tombstone_entry */
static int
usn_get_attr(Slapi_PBlock *pb, const char* type, void *value)
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_delete.c b/ldap/servers/slapd/back-ldbm/ldbm_delete.c
index f2454be..dc759b4 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_delete.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_delete.c
@@ -116,6 +116,7 @@ ldbm_back_delete( Slapi_PBlock *pb )
if (NULL == addr)
{
+ /* retval is -1 */
goto error_return;
}
ldap_result_code = slapi_dn_syntax_check(pb, addr->dn, 1);
@@ -123,6 +124,7 @@ ldbm_back_delete( Slapi_PBlock *pb )
{
ldap_result_code = LDAP_INVALID_DN_SYNTAX;
slapi_pblock_get(pb, SLAPI_PB_RESULT_TEXT, &ldap_result_message);
+ /* retval is -1 */
goto error_return;
}
@@ -158,19 +160,22 @@ ldbm_back_delete( Slapi_PBlock *pb )
operation->o_status = SLAPI_OP_STATUS_WILL_COMPLETE;
}
if ( slapi_op_abandoned( pb ) ) {
+ /* retval is -1 */
goto error_return;
}
/* find and lock the entry we are about to modify */
if ( (e = find_entry2modify( pb, be, addr, NULL )) == NULL )
{
- ldap_result_code= -1;
+ ldap_result_code= LDAP_NO_SUCH_OBJECT;
+ /* retval is -1 */
goto error_return; /* error result sent by find_entry2modify() */
}
if ( slapi_entry_has_children( e->ep_entry ) )
{
ldap_result_code= LDAP_NOT_ALLOWED_ON_NONLEAF;
+ /* retval is -1 */
goto error_return;
}
@@ -194,6 +199,7 @@ ldbm_back_delete( Slapi_PBlock *pb )
{
/* restore original entry so the front-end delete code can free it */
slapi_pblock_set( pb, SLAPI_DELETE_BEPREOP_ENTRY, orig_entry );
+ /* retval is -1 */
goto error_return;
}
slapi_pblock_set(pb, SLAPI_RESULT_CODE, &ldap_result_code);
@@ -211,6 +217,7 @@ ldbm_back_delete( Slapi_PBlock *pb )
slapi_pblock_get(pb, SLAPI_RESULT_CODE, &ldap_result_code);
/* restore original entry so the front-end delete code can free it */
slapi_pblock_set( pb, SLAPI_DELETE_BEPREOP_ENTRY, orig_entry );
+ /* retval is -1 */
goto error_return;
}
/* the flag could be set in a preop plugin (e.g., USN) */
@@ -294,6 +301,7 @@ ldbm_back_delete( Slapi_PBlock *pb )
if ( ldap_result_code != LDAP_SUCCESS )
{
ldap_result_message= errbuf;
+ /* retval is -1 */
goto error_return;
}
@@ -766,8 +774,7 @@ ldbm_back_delete( Slapi_PBlock *pb )
}
if (entryrdn_get_switch()) /* subtree-rename: on */
{
- retval =
- entryrdn_index_entry(be, e, BE_INDEX_DEL, &txn);
+ retval = entryrdn_index_entry(be, e, BE_INDEX_DEL, &txn);
if (DB_LOCK_DEADLOCK == retval) {
LDAPDebug0Args( LDAP_DEBUG_ARGS,
"delete (deleting entryrdn) DB_LOCK_DEADLOCK\n");
@@ -852,6 +859,7 @@ ldbm_back_delete( Slapi_PBlock *pb )
/* Failed */
LDAPDebug( LDAP_DEBUG_ANY, "Retry count exceeded in delete\n", 0, 0, 0 );
ldap_result_code= LDAP_OPERATIONS_ERROR;
+ retval = -1;
goto error_return;
}
@@ -885,6 +893,7 @@ ldbm_back_delete( Slapi_PBlock *pb )
ldap_result_code= LDAP_OPERATIONS_ERROR;
LDAPDebug( LDAP_DEBUG_ANY,
"ldbm_back_delete: modify_switch_entries failed\n", 0, 0, 0);
+ retval = -1;
goto error_return;
}
}
@@ -893,10 +902,6 @@ ldbm_back_delete( Slapi_PBlock *pb )
goto common_return;
error_return:
- if (e!=NULL) {
- cache_unlock_entry( &inst->inst_cache, e );
- CACHE_RETURN( &inst->inst_cache, &e );
- }
if (tombstone_in_cache)
{
CACHE_REMOVE( &inst->inst_cache, tombstone );
@@ -941,9 +946,27 @@ common_return:
* but not if the operation is purging tombstones.
*/
if (!delete_tombstone_entry) {
+ if (e) {
+ /* set entry in case be-postop plugins need to work on it
+ * (e.g., USN) */
+ slapi_pblock_get( pb, SLAPI_DELETE_BEPOSTOP_ENTRY, &orig_entry );
+ slapi_pblock_set( pb, SLAPI_DELETE_BEPOSTOP_ENTRY, e->ep_entry );
+ }
plugin_call_plugins (pb, SLAPI_PLUGIN_BE_POST_DELETE_FN);
+ /* set original entry back */
+ if (e) {
+ slapi_pblock_set( pb, SLAPI_DELETE_BEPOSTOP_ENTRY, orig_entry );
+ }
}
+ /* Need to return to cache after post op plugins are called */
+ if (retval) { /* error case */
+ if (e) {
+ cache_unlock_entry( &inst->inst_cache, e );
+ CACHE_RETURN( &inst->inst_cache, &e );
+ }
+ }
+
if (ruv_c_init) {
modify_term(&ruv_c, be);
}
diff --git a/ldap/servers/slapd/slapi-plugin.h b/ldap/servers/slapd/slapi-plugin.h
index 81db71f..dd601ca 100644
--- a/ldap/servers/slapd/slapi-plugin.h
+++ b/ldap/servers/slapd/slapi-plugin.h
@@ -5931,6 +5931,7 @@ typedef struct slapi_plugindesc {
#define SLAPI_DELETE_EXISTING_ENTRY SLAPI_ADD_EXISTING_DN_ENTRY
#define SLAPI_DELETE_GLUE_PARENT_ENTRY SLAPI_ADD_PARENT_ENTRY
#define SLAPI_DELETE_BEPREOP_ENTRY SLAPI_ENTRY_PRE_OP
+#define SLAPI_DELETE_BEPOSTOP_ENTRY SLAPI_ENTRY_POST_OP
/* modify arguments */
#define SLAPI_MODIFY_TARGET SLAPI_TARGET_DN
13 years, 3 months
console/src/com/netscape/management/client/ug ResourcePageObservable.java, 1.2, 1.3
by Nathan Kinder
Author: nkinder
Update of /cvs/dirsec/console/src/com/netscape/management/client/ug
In directory cvs01.phx2.fedoraproject.org:/tmp/cvs-serv11522/src/com/netscape/management/client/ug
Modified Files:
ResourcePageObservable.java
Log Message:
Bug 583652 - Console caches magic numbers instead of DNA-generated values
The users and groups tab currently fills in the contents of an entry after
an add or modify using the values one entered into Console. If the server
added any other attributes or modified any values (such as DNA does), those
values will not be shown unless one searches for the entry again.
This patch causes the Consoel to refresh the entry by searching for it
again after an add or modify operation. The result is that one sees the
actual contents of the entry as they exist in the server.
Index: ResourcePageObservable.java
===================================================================
RCS file: /cvs/dirsec/console/src/com/netscape/management/client/ug/ResourcePageObservable.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ResourcePageObservable.java 3 May 2010 20:37:56 -0000 1.2
+++ ResourcePageObservable.java 7 Feb 2011 19:49:52 -0000 1.3
@@ -363,7 +363,12 @@
LDAPEntry newEntry = new LDAPEntry(newRDN, Attrs);
ldapConnection.add(newEntry);
+
_entry = newEntry;
+
+ // Refresh so we get a copy of the entrt from the DS. This ensures
+ // that we see any updates that the DS added to the entry.
+ refresh();
}
catch (LDAPException e) {
Debug.println(0,
13 years, 3 months
src/com
by Noriko Hosoi
src/com/netscape/admin/dirserv/panel/DSEntrySet.java | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
New commits:
commit d77ff59e526e9e085f60f31a292d766512723338
Author: Noriko Hosoi <nhosoi(a)jiji.usersys.redhat.com>
Date: Fri Feb 4 17:59:41 2011 -0800
Bug 661116 - 389-console Configuration tab admin permissions
(nsslapd-referral ?) and folder not expending immediatly
https://bugzilla.redhat.com/show_bug.cgi?id=661116
Description: ds-console always expects nsslapd-referral in
cn=console, which is not true.
This patch appends the empty attribute value if the search
result does not contain expected attributes.
diff --git a/src/com/netscape/admin/dirserv/panel/DSEntrySet.java b/src/com/netscape/admin/dirserv/panel/DSEntrySet.java
index c40247a..b01d5a6 100644
--- a/src/com/netscape/admin/dirserv/panel/DSEntrySet.java
+++ b/src/com/netscape/admin/dirserv/panel/DSEntrySet.java
@@ -185,7 +185,12 @@ public class DSEntrySet {
if (lda == null && entry != null) {
Debug.println( "DSEntrySet.getAttributes(): failed to get " +
"attribute " + attrName + " in " + entry.getDN());
- haveAllAttrs = false; // missing at least one attr value
+ // missing at least one attr value
+ // haveAllAttrs = false;
+ // Instead of returning an auth error, create an empty attr
+ Debug.println( "DSEntrySet.getAttributes(): created " +
+ "attribute " + attrName + " in " + entry.getDN());
+ lda = new LDAPAttribute(attrName, "");
}
// loop through all of the DSEntrys which
13 years, 3 months
configure configure.ac
by Noriko Hosoi
configure | 11 +++++------
configure.ac | 11 +++++------
2 files changed, 10 insertions(+), 12 deletions(-)
New commits:
commit 4aecc235548490c4ff3a26066471fa6399c6f367
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Fri Feb 4 13:37:36 2011 -0800
Bug 618858 - move start-ds-admin env file into main admin server
config path
https://bugzilla.redhat.com/show_bug.cgi?id=618858
Description by Ulf Weltman (ulf.weltman(a)hp.com):
To improve feng-shui on HP-UX we modify the layout by moving
start-ds-admin's env file dirsrv-admin from
/etc/opt/dirsrv-admin/config to /etc/opt/dirsrv/admin-serv.
(On HP-UX we keep files in /opt/dirsrv, /var/opt/dirsrv and
/etc/opt/dirsrv. That additional /etc/opt/dirsrv-admin path
was awkward since it just contained the single env file.)
I had to move the assignment of the instancename variable up
in the file so it's available when the initconfigdir is set.
diff --git a/configure b/configure
index 87c4c08..1a1cc46 100755
--- a/configure
+++ b/configure
@@ -16714,6 +16714,9 @@ httpduser=nobody
httpdgroup=nobody
admservport=9830
admservip=0.0.0.0
+# this is the subdir under $PACKAGE_BASE_NAME where admin server
+# specific configs, logs, etc. are found
+instancename=admin-serv
# initdir
# initdir is the location for the SysV init scripts - very heavily platform
# dependent and not specified in fhs or lsb
@@ -16793,7 +16796,7 @@ $as_echo "#define _HPUX_SOURCE 1" >>confdefs.h
CXXLINK_REQUIRED=1
httpdgroup=nogroup
platform="hpux"
- initconfigdir="/$PACKAGE_NAME/config"
+ initconfigdir="/$PACKAGE_BASE_NAME/$instancename"
# HPUX doesn't use /etc for this
initdir=/init.d
;;
@@ -16830,7 +16833,7 @@ $as_echo "#define _HPUX_SOURCE 1" >>confdefs.h
# assume 64 bit
perlexec='/opt/perl_64/bin/perl'
platform="hpux"
- initconfigdir="/$PACKAGE_NAME/config"
+ initconfigdir="/$PACKAGE_BASE_NAME/$instancename"
# HPUX doesn't use /etc for this
initdir=/init.d
;;
@@ -18946,10 +18949,6 @@ else
fi
-# this is the subdir under $PACKAGE_BASE_NAME where admin server
-# specific configs, logs, etc. are found
-instancename=admin-serv
-
# check for --with-instconfigdir
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --with-instconfigdir" >&5
$as_echo_n "checking for --with-instconfigdir... " >&6; }
diff --git a/configure.ac b/configure.ac
index 6d72542..9fd1b3f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -117,6 +117,9 @@ httpduser=nobody
httpdgroup=nobody
admservport=9830
admservip=0.0.0.0
+# this is the subdir under $PACKAGE_BASE_NAME where admin server
+# specific configs, logs, etc. are found
+instancename=admin-serv
# initdir
# initdir is the location for the SysV init scripts - very heavily platform
# dependent and not specified in fhs or lsb
@@ -166,7 +169,7 @@ case $host in
CXXLINK_REQUIRED=1
httpdgroup=nogroup
platform="hpux"
- initconfigdir="/$PACKAGE_NAME/config"
+ initconfigdir="/$PACKAGE_BASE_NAME/$instancename"
# HPUX doesn't use /etc for this
initdir=/init.d
;;
@@ -185,7 +188,7 @@ case $host in
# assume 64 bit
perlexec='/opt/perl_64/bin/perl'
platform="hpux"
- initconfigdir="/$PACKAGE_NAME/config"
+ initconfigdir="/$PACKAGE_BASE_NAME/$instancename"
# HPUX doesn't use /etc for this
initdir=/init.d
;;
@@ -260,10 +263,6 @@ m4_include(m4/mod_nss.m4)
m4_include(m4/selinux.m4)
AM_CONDITIONAL(SELINUX,test "$with_selinux" = "yes")
-# this is the subdir under $PACKAGE_BASE_NAME where admin server
-# specific configs, logs, etc. are found
-instancename=admin-serv
-
# check for --with-instconfigdir
AC_MSG_CHECKING(for --with-instconfigdir)
AC_ARG_WITH(instconfigdir,
13 years, 3 months